Flex_Layout_Renderer
in package
This class provides functionality to render inner blocks of a block that supports reduced flex layout.
Table of Contents
- render_inner_blocks_in_layout() : string
- Render inner blocks in flex layout.
- compute_widths_for_flex_layout() : array<string|int, mixed>
- Compute widths for blocks in flex layout.
- get_width_without_gap() : int
- How much of width we will strip to keep some space for the gap This is computed based on CSS rule used in the editor: For block with width set to X percent width: calc(X% - (var(--wp--style--block-gap) * (100 - X)/100)));
Methods
render_inner_blocks_in_layout()
Render inner blocks in flex layout.
public
render_inner_blocks_in_layout(array<string|int, mixed> $parsed_block, Settings_Controller $settings_controller) : string
Parameters
- $parsed_block : array<string|int, mixed>
-
Parsed block.
- $settings_controller : Settings_Controller
-
Settings controller.
Return values
string —compute_widths_for_flex_layout()
Compute widths for blocks in flex layout.
private
compute_widths_for_flex_layout(array<string|int, mixed> $parsed_block, Settings_Controller $settings_controller, float $flex_gap) : array<string|int, mixed>
Parameters
- $parsed_block : array<string|int, mixed>
-
Parsed block.
- $settings_controller : Settings_Controller
-
Settings controller.
- $flex_gap : float
-
Flex gap.
Return values
array<string|int, mixed> —get_width_without_gap()
How much of width we will strip to keep some space for the gap This is computed based on CSS rule used in the editor: For block with width set to X percent width: calc(X% - (var(--wp--style--block-gap) * (100 - X)/100)));
private
get_width_without_gap(float $block_width, float $flex_gap, float $block_width_percent) : int
Parameters
- $block_width : float
-
Block width in pixels.
- $flex_gap : float
-
Flex gap in pixels.
- $block_width_percent : float
-
Block width in percent.