Automattic\WooCommerce\Blocks\BlockTypes\ProductCollection
Renderer::handle_render_block_context
Extend context only for Product Collection blocks and their descendants.
Метод класса: Renderer{}
Хуков нет.
Возвращает
array.
Использование
$Renderer = new Renderer(); $Renderer->handle_render_block_context( $context, $parsed_block, $parent_block );
- $context(массив) (обязательный)
- The block context.
- $parsed_block(массив) (обязательный)
- The parsed block being rendered.
- $parent_block(WP_Block|null)
- The parent block instance, or null for a top-level block.
По умолчанию:null
Список изменений
| С версии 11.3.0 | Введена. |
Код Renderer::handle_render_block_context() Renderer::handle render block context WC 11.3.0
public function handle_render_block_context( $context, $parsed_block, $parent_block = null ) {
$block_name = $parsed_block['blockName'] ?? '';
if (
'woocommerce/product-collection' !== $block_name &&
(
! $parent_block instanceof \WP_Block ||
( 'woocommerce/product-collection' !== $parent_block->name && ( ! isset( $parent_block->context['isProductCollectionInnerBlock'] ) || true !== ( $parent_block->context['isProductCollectionInnerBlock'] ) ) )
)
) {
return $context;
}
return $this->extend_context_for_inner_blocks( $context, $parsed_block );
}