Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks
Quote::get_block_wrapper
Returns the block wrapper.
Method of the class: Quote{}
No Hooks.
Returns
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->get_block_wrapper( $block_content, $parsed_block, $settings_controller ): string;
- $block_content(string) (required)
- Block content.
- $parsed_block(array) (required)
- Parsed block.
- $settings_controller(Settings_Controller) (required)
- Settings controller.
Quote::get_block_wrapper() Quote::get block wrapper code WC 9.9.5
private function get_block_wrapper( string $block_content, array $parsed_block, Settings_Controller $settings_controller ): string { $original_classname = ( new Dom_Document_Helper( $block_content ) )->get_attribute_value_by_tag_name( 'blockquote', 'class' ) ?? ''; $block_attributes = wp_parse_args( $parsed_block['attrs'] ?? array(), array( 'style' => array(), 'backgroundColor' => '', 'textColor' => '', 'borderColor' => '', ) ); // Layout, background, borders need to be on the outer table element. $border = $block_attributes['style']['border'] ?? array(); $border_color_attribute = $block_attributes['borderColor'] ? $settings_controller->translate_slug_to_color( $block_attributes['borderColor'] ) : null; if ( ! isset( $border['color'] ) && ! is_null( $border_color_attribute ) ) { $border['color'] = $border_color_attribute; } $table_styles = $this->get_styles_from_block( array( 'color' => array_filter( array( 'background' => $block_attributes['backgroundColor'] ? $settings_controller->translate_slug_to_color( $block_attributes['backgroundColor'] ) : null, 'text' => $block_attributes['textColor'] ? $settings_controller->translate_slug_to_color( $block_attributes['textColor'] ) : null, ) ), 'background' => $block_attributes['style']['background'] ?? array(), 'border' => $border, ) )['declarations']; // Set the text align attribute to the wrapper if present. if ( isset( $parsed_block['attrs']['textAlign'] ) ) { $table_styles['text-align'] = $parsed_block['attrs']['textAlign']; } $table_styles['border-collapse'] = 'separate'; // Needed for the border radius to work. // Add default background size. $table_styles['background-size'] = empty( $table_styles['background-size'] ) ? 'cover' : $table_styles['background-size']; // Padding properties need to be added to the table cell. $cell_styles = $this->get_styles_from_block( array( 'spacing' => array( 'padding' => $block_attributes['style']['spacing']['padding'] ?? array() ), ) )['declarations']; return sprintf( '<table class="email-block-quote %3$s" style="%1$s" width="100%%" border="0" cellpadding="0" cellspacing="0" role="presentation"> <tbody> <tr> <td class="email-block-quote-content" style="%2$s" width="100%%"> {quote_content} {citation_content} </td> </tr> </tbody> </table>', esc_attr( WP_Style_Engine::compile_css( $table_styles, '' ) ), esc_attr( WP_Style_Engine::compile_css( $cell_styles, '' ) ), esc_attr( $original_classname ), ); }