Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails

WCEmailPostsCleanup::email_type_from_option_name │ private static │ WC 1.0

Derive the email type from a mapping option name.

Method of the class: WCEmailPostsCleanup{}

No Hooks.

Returns

string|null. The email type, e.g. customer_new_account, or null when the name doesn't match the mapping shape exactly.

Usage

$result = WCEmailPostsCleanup::email_type_from_option_name( $option_name ): ?string;
$option_name(string) (required)
Option name, e.g. woocommerce_email_templates_customer_new_account_post_id.

WCEmailPostsCleanup::email_type_from_option_name() code WC 11.1.2

private static function email_type_from_option_name( string $option_name ): ?string {
	if ( 1 !== preg_match( '/^woocommerce_email_templates_(.+)_post_id$/', $option_name, $matches ) ) {
		return null;
	}

	return $matches[1];
}