Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer\Layout

Flex_Layout_Renderer::render_single_row_layoutprivateWC 1.0

Render the inner blocks as a single, non-wrapping row.

This is the default layout: a table row whose cells sit side by side. It's correct whenever the items are known to fit the available width (and it's what every explicitly-sized buttons block uses, since those are shrunk to fit by {@see compute_widths_for_flex_layout()}).

Метод класса: Flex_Layout_Renderer{}

Хуков нет.

Возвращает

string.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->render_single_row_layout( $inner_blocks, $styles, $justify, $flex_gap, $rendering_context ): string;
$inner_blocks(массив) (обязательный)
Inner blocks with computed widths.
$styles(строка) (обязательный)
Wrapper styles (already includes margin-top and text-align).
$justify(строка) (обязательный)
Resolved horizontal alignment (left/center/right).
$flex_gap(строка) (обязательный)
Gap between items (e.g. "16px").
$rendering_context(Rendering_Context) (обязательный)
Rendering context.

Код Flex_Layout_Renderer::render_single_row_layout() WC 11.1.1

private function render_single_row_layout( array $inner_blocks, string $styles, string $justify, string $flex_gap, Rendering_Context $rendering_context ): string {
	// MS Outlook doesn't support style attribute in divs so we conditionally wrap the buttons in a table and repeat styles.
	$output_html = sprintf(
		'<!--[if mso | IE]><table align="%2$s" role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%%"><tr><td style="%1$s" ><![endif]-->
      <div style="%1$s"><table class="layout-flex-wrapper" style="display:inline-block;vertical-align:top"><tbody><tr>',
		esc_attr( $styles ),
		esc_attr( $justify )
	);

	foreach ( $inner_blocks as $key => $block ) {
		$item_styles = array();
		if ( $block['email_attrs']['layout_width'] ?? null ) {
			$item_styles['width'] = $block['email_attrs']['layout_width'];
		}
		if ( $key > 0 ) {
			$item_styles[ 'padding-' . $rendering_context->get_start_side() ] = $flex_gap;
		}
		$output_html .= '<td class="layout-flex-item" style="' . esc_attr( \WP_Style_Engine::compile_css( $item_styles, '' ) ) . '">' . render_block( $block ) . '</td>';
	}
	$output_html .= '</tr></table></div>
    <!--[if mso | IE]></td></tr></table><![endif]-->';

	return $output_html;
}