MailPoet\EmailEditor\Engine\Renderer\ContentRenderer\Preprocessors
Typography_Preprocessor::preprocess_parent()
Preprocess parent block
Method of the class: Typography_Preprocessor{}
No Hooks.
Return
Array
.
Usage
// private - for code of main (parent) class only $result = $this->preprocess_parent( $block ): array;
- $block(array) (required)
- Block to preprocess.
Typography_Preprocessor::preprocess_parent() Typography Preprocessor::preprocess parent code WC 9.8.1
private function preprocess_parent( array $block ): array { // Build styles that should be copied to children. $email_attrs = array(); if ( isset( $block['attrs']['style']['color']['text'] ) ) { $email_attrs['color'] = $block['attrs']['style']['color']['text']; } // In case the fontSize is set via a slug (small, medium, large, etc.) we translate it to a number // The font size slug is set in $block['attrs']['fontSize'] and value in $block['attrs']['style']['typography']['fontSize']. if ( isset( $block['attrs']['fontSize'] ) ) { $block['attrs']['style']['typography']['fontSize'] = $this->settings_controller->translate_slug_to_font_size( $block['attrs']['fontSize'] ); } // Pass font size to email_attrs. if ( isset( $block['attrs']['style']['typography']['fontSize'] ) ) { $email_attrs['font-size'] = $block['attrs']['style']['typography']['fontSize']; } if ( isset( $block['attrs']['style']['typography']['textDecoration'] ) ) { $email_attrs['text-decoration'] = $block['attrs']['style']['typography']['textDecoration']; } $block['email_attrs'] = array_merge( $email_attrs, $block['email_attrs'] ?? array() ); return $block; }