Automattic\WooCommerce\Blocks\BlockTypes
ProductGallery::get_product_image_attributes
Find the Product Image block attributes used by the gallery.
Метод класса: ProductGallery{}
Хуков нет.
Возвращает
array|null.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_product_image_attributes( $inner_blocks );
- $inner_blocks(iterable<\WP_Block>) (обязательный)
- Inner blocks to search.
Код ProductGallery::get_product_image_attributes() ProductGallery::get product image attributes WC 11.2.1
private function get_product_image_attributes( $inner_blocks ) {
foreach ( $inner_blocks as $inner_block ) {
if ( 'woocommerce/product-image' === $inner_block->name ) {
return $inner_block->parsed_block['attrs'] ?? array();
}
$found_attributes = $this->get_product_image_attributes( $inner_block->inner_blocks );
if ( null !== $found_attributes ) {
return $found_attributes;
}
}
return null;
}