Automattic\WooCommerce\Blocks\Templates
SingleProductTemplateCompatibility::add_compatibility_layer()
Add compatibility layer to the first and last block of the Single Product Template.
Метод класса: SingleProductTemplateCompatibility{}
Хуков нет.
Возвращает
Строку
.
Использование
$result = SingleProductTemplateCompatibility::add_compatibility_layer( $template_content );
- $template_content(строка) (обязательный)
- Template.
Код SingleProductTemplateCompatibility::add_compatibility_layer() SingleProductTemplateCompatibility::add compatibility layer WC 7.7.2
public static function add_compatibility_layer( $template_content ) { $wrapped_blocks = self::wrap_single_product_template( $template_content ); $template = self::inject_custom_attributes_to_first_and_last_block_single_product_template( $wrapped_blocks ); return array_reduce( $template, function( $carry, $item ) { if ( is_array( $item ) ) { return $carry . serialize_blocks( $item ); } return $carry . serialize_block( $item ); }, '' ); }