Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails

WCTransactionalEmailPostsGenerator::resolve_block_template_name │ public static │ WC 10.8.0

Resolve the block template name for the given email.

Returns $email->template_block when set, otherwise derives it from $email->template_plain by replacing the plain segment with block (e.g. emails/plain/customer-invoice.php becomes emails/block/customer-invoice.php).

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

Хуков нет.

Возвращает

string. The block template name, or an empty string if none can be resolved.

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

$result = WCTransactionalEmailPostsGenerator::resolve_block_template_name( $email ): string;
$email(WC_Email) (обязательный)
The email object.

Список изменений

С версии 10.8.0 Введена.

Код WCTransactionalEmailPostsGenerator::resolve_block_template_name() WC 11.2.2

public static function resolve_block_template_name( $email ): string {
	if ( ! empty( $email->template_block ) ) {
		return (string) $email->template_block;
	}

	$template_plain = (string) $email->template_plain;
	if ( '' === $template_plain ) {
		return '';
	}

	return str_replace( 'plain', 'block', $template_plain );
}