Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks
Gallery::build_gallery_table
Build the gallery table structure with proper rows and cells. Uses the tiled gallery pattern: separate tables for each row, then wrap in main table.
Метод класса: Gallery{}
Хуков нет.
Возвращает
Строку. Gallery table HTML.
Использование
// private - только в коде основоного (родительского) класса $result = $this->build_gallery_table( $gallery_images, $columns ): string;
- $gallery_images(массив) (обязательный)
- Array of image HTML strings.
- $columns(int) (обязательный)
- Number of columns.
Код Gallery::build_gallery_table() Gallery::build gallery table WC 10.4.3
private function build_gallery_table( array $gallery_images, int $columns ): string {
$content_parts = array();
$image_count = count( $gallery_images );
$cell_padding = 8; // 0.5em equivalent (approximately 8px)
// Process images in chunks based on columns to create rows.
for ( $i = 0; $i < $image_count; $i += $columns ) {
$row_images = array_slice( $gallery_images, $i, $columns );
$content_parts[] = $this->build_gallery_row_table( $row_images, $columns, $cell_padding );
}
return implode( '', $content_parts );
}