Automattic\WooCommerce\Blocks
BlockTemplatesController::add_plugin_templates_parts_support()
By default, the Template Part Block only supports template parts that are in the current theme directory. This render_callback wrapper allows us to add support for plugin-housed template parts.
Метод класса: BlockTemplatesController{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$BlockTemplatesController = new BlockTemplatesController(); $BlockTemplatesController->add_plugin_templates_parts_support( $settings, $metadata );
- $settings(массив) (обязательный)
- Array of determined settings for registering a block type.
- $metadata(массив) (обязательный)
- Metadata provided for registering a block type.
Код BlockTemplatesController::add_plugin_templates_parts_support() BlockTemplatesController::add plugin templates parts support WC 9.3.3
public function add_plugin_templates_parts_support( $settings, $metadata ) { if ( isset( $metadata['name'], $settings['render_callback'] ) && 'core/template-part' === $metadata['name'] && in_array( $settings['render_callback'], array( 'render_block_core_template_part', 'gutenberg_render_block_core_template_part' ), true ) ) { $settings['render_callback'] = array( $this, 'render_woocommerce_template_part' ); } return $settings; }