WC_Settings_Emails::email_preview_single()publicWC 1.0

Creates the React mount point for the single email preview.

Метод класса: WC_Settings_Emails{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Settings_Emails = new WC_Settings_Emails();
$WC_Settings_Emails->email_preview_single( $email );
$email(объект) (обязательный)
The email object to run the method on.

Код WC_Settings_Emails::email_preview_single() WC 9.7.1

<?php
public function email_preview_single( $email ) {
	$this->delete_transient_email_settings( $email->id );
	// Email types array should have a single entry for current email.
	$email_types = array(
		array(
			'label' => $email->get_title(),
			'value' => get_class( $email ),
		),
	);
	?>
	<h2><?php echo esc_html( __( 'Email preview', 'woocommerce' ) ); ?></h2>

	<p><?php echo esc_html( __( 'Preview your email template. You can also test on different devices and send yourself a test email.', 'woocommerce' ) ); ?></p>
	<div>
		<div
			id="wc_settings_email_preview_slotfill"
			data-preview-url="<?php echo esc_url( wp_nonce_url( admin_url( '?preview_woocommerce_mail=true' ), 'preview-mail' ) ); ?>"
			data-email-types="<?php echo esc_attr( wp_json_encode( $email_types ) ); ?>"
			data-email-settings-ids="<?php echo esc_attr( wp_json_encode( EmailPreview::get_email_content_settings_ids( $email->id ) ) ); ?>"
		></div>
		<input type="hidden" id="woocommerce_email_from_name" value="<?php echo esc_attr( get_option( 'woocommerce_email_from_name' ) ); ?>" />
		<input type="hidden" id="woocommerce_email_from_address" value="<?php echo esc_attr( get_option( 'woocommerce_email_from_address' ) ); ?>" />
	</div>
	<?php
}