Automattic\WooCommerce\Blocks\Domain
BlockRegistrationContext::should_register
Whether block types and patterns should be registered for the current request.
Метод класса: BlockRegistrationContext{}
Хуки из метода
Возвращает
bool. True unless the request is a known non-rendering context.
Использование
$BlockRegistrationContext = new BlockRegistrationContext(); $BlockRegistrationContext->should_register(): bool;
Код BlockRegistrationContext::should_register() BlockRegistrationContext::should register WC 11.2.2
public function should_register(): bool {
/**
* Filters whether WooCommerce should register its block types and patterns for the current request.
*
* Registration is skipped on known non-rendering contexts (the Store API and other WooCommerce REST
* namespaces, cron, AJAX, XML-RPC, favicon, robots.txt and XML sitemaps) as a performance optimisation.
* Product and variation descriptions rendered through do_blocks and emails rendered by the email editor are
* already handled on demand (see the woocommerce_short_description and woocommerce_email_editor_render_start
* hooks in Bootstrap), so this filter is only needed to opt back in when an extension renders WooCommerce
* blocks some other way in one of those contexts.
*
* @since 11.1.0
*
* @param bool $should_register Whether block types and patterns should be registered for this request.
*/
return (bool) apply_filters( 'woocommerce_should_register_blocks', $this->is_rendering_request() );
}