WC_Email::get_option_or_transient
Get an option or transient for email preview.
Метод класса: WC_Email{}
Хуки из метода
Возвращает
null. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_option_or_transient( $key, $empty_value );
- $key(строка) (обязательный)
- Option key.
- $empty_value(разное)
- Value to use when option is empty.
По умолчанию:null
Код WC_Email::get_option_or_transient() WC Email::get option or transient WC 10.7.0
protected function get_option_or_transient( string $key, $empty_value = null ) {
$option = $this->get_option( $key, $empty_value );
/**
* This filter is documented in templates/emails/email-styles.php
*
* @since 9.6.0
* @param bool $is_email_preview Whether the email is being previewed.
*/
$is_email_preview = apply_filters( 'woocommerce_is_email_preview', false );
if ( $is_email_preview ) {
$plugin_id = $this->plugin_id;
$email_id = $this->id;
$transient = get_transient( "{$plugin_id}{$email_id}_{$key}" );
if ( false !== $transient ) {
$option = $transient ? $transient : $empty_value;
}
}
return $option;
}