Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors
Blocks_Width_Preprocessor::get_block_horizontal_border
Sum a block's left and right border widths.
Supports both the shorthand border.width and the per-side border.left.width / border.right.width formats, matching how the columns block border is read elsewhere in this class.
Method of the class: Blocks_Width_Preprocessor{}
No Hooks.
Returns
float. Combined horizontal border width in pixels.
Usage
// private - for code of main (parent) class only $result = $this->get_block_horizontal_border( $block ): float;
- $block(array) (required)
- Parsed block.
Blocks_Width_Preprocessor::get_block_horizontal_border() Blocks Width Preprocessor::get block horizontal border code WC 11.0.1
private function get_block_horizontal_border( array $block ): float {
$border_width = $block['attrs']['style']['border']['width'] ?? '0px';
$left = $block['attrs']['style']['border']['left']['width'] ?? $border_width;
$right = $block['attrs']['style']['border']['right']['width'] ?? $border_width;
return $this->parse_number_from_string_with_pixels( (string) $left ) + $this->parse_number_from_string_with_pixels( (string) $right );
}