Automattic\WooCommerce\Internal\EmailEditor\PersonalizationTags

SiteTagsProvider::register_tagspublicWC 1.0

Register site tags with the registry.

Method of the class: SiteTagsProvider{}

No Hooks.

Returns

null. Nothing (null).

Usage

$SiteTagsProvider = new SiteTagsProvider();
$SiteTagsProvider->register_tags( $registry ): void;
$registry(Personalization_Tags_Registry) (required)
The personalization tags registry.

SiteTagsProvider::register_tags() code WC 10.3.6

public function register_tags( Personalization_Tags_Registry $registry ): void {
	$registry->register(
		new Personalization_Tag(
			__( 'Site Title', 'woocommerce' ),
			'woocommerce/site-title',
			__( 'Site', 'woocommerce' ),
			function ( array $context ): string {
				if ( isset( $context['order'] ) && PointOfSaleOrderUtil::is_pos_order( $context['order'] ) ) {
					$store_name = get_option( 'woocommerce_pos_store_name' );
					return htmlspecialchars_decode( empty( $store_name ) ? PointOfSaleDefaultSettings::get_default_store_name() : $store_name, ENT_QUOTES );
				}
				return htmlspecialchars_decode( get_bloginfo( 'name' ) );
			},
			array(),
			null,
			array( Integration::EMAIL_POST_TYPE ),
		)
	);

	$registry->register(
		new Personalization_Tag(
			__( 'Homepage URL', 'woocommerce' ),
			'woocommerce/site-homepage-url',
			__( 'Site', 'woocommerce' ),
			function (): string {
				return get_bloginfo( 'url' );
			},
			array(),
			null,
			array( Integration::EMAIL_POST_TYPE ),
		)
	);
}