Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails

WCEmailTemplateChangeSummary::block_labelprivate staticWC 1.0

Convert a normalized block name into a human-readable label. Used for both structured payload entries and the localized catalog.

core/headingHeading; woocommerce/email-contentEmail content.

Method of the class: WCEmailTemplateChangeSummary{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = WCEmailTemplateChangeSummary::block_label( $normalized_name ): string;
$normalized_name(string) (required)
Normalized block name.

WCEmailTemplateChangeSummary::block_label() code WC 10.9.1

private static function block_label( string $normalized_name ): string {
	$bare = preg_replace( '#^[a-z0-9\-]+/#', '', $normalized_name );
	$bare = (string) $bare;
	$bare = str_replace( array( '-', '_' ), ' ', $bare );
	$bare = trim( $bare );
	if ( '' === $bare ) {
		return $normalized_name;
	}
	return ucfirst( $bare );
}