Automattic\WooCommerce\Blocks\Domain\Services

Notices::init()publicWC 1.0

Initialize notice hooks.

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

Возвращает

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

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

$Notices = new Notices();
$Notices->init();

Код Notices::init() WC 9.6.1

public function init() {
	add_action(
		'after_setup_theme',
		function () {
			/**
			 * Allow classic theme developers to opt-in to using block notices.
			 *
			 * @since 8.8.0
			 * @param bool $use_block_notices_in_classic_theme Whether to use block notices in classic theme.
			 * @return bool
			 */
			if ( wp_is_block_theme() || apply_filters( 'woocommerce_use_block_notices_in_classic_theme', false ) ) {
				add_filter( 'wc_get_template', [ $this, 'get_notices_template' ], 10, 5 );
			}
		}
	);

	add_filter( 'woocommerce_kses_notice_allowed_tags', [ $this, 'add_kses_notice_allowed_tags' ] );
	add_action( 'wp_head', [ $this, 'enqueue_notice_styles' ] );
}