Typography_Preprocessor
in package
implements
Preprocessor
This preprocessor is responsible for setting default typography values for blocks.
Interfaces, Classes and Traits
- Preprocessor
- Interface Preprocessor
Table of Contents
- TYPOGRAPHY_STYLES = array('color', 'font-size', 'text-decoration')
- List of styles that should be copied from parent to children.
- $settings_controller : Settings_Controller
- Injected settings controller
- __construct() : mixed
- Typography_Preprocessor constructor.
- preprocess() : array<string|int, mixed>
- Method to preprocess the content before rendering
- copy_typography_from_parent() : array<string|int, mixed>
- Copy typography styles from parent to children
- filterStyles() : array<string|int, mixed>
- Filter styles to only include typography styles
- preprocess_parent() : array<string|int, mixed>
- Preprocess parent block
- set_defaults_from_theme() : array<string|int, mixed>
- Set default values from theme
Constants
TYPOGRAPHY_STYLES
List of styles that should be copied from parent to children.
private
array<string|int, string>
TYPOGRAPHY_STYLES
= array('color', 'font-size', 'text-decoration')
Properties
$settings_controller
Injected settings controller
private
Settings_Controller
$settings_controller
Methods
__construct()
Typography_Preprocessor constructor.
public
__construct(Settings_Controller $settings_controller) : mixed
Parameters
- $settings_controller : Settings_Controller
-
Settings controller.
Return values
mixed —preprocess()
Method to preprocess the content before rendering
public
preprocess(array<string|int, mixed> $parsed_blocks, array{contentSize: string} $layout, array{spacing: array{padding: array{bottom: string, left: string, right: string, top: string}, blockGap: string}} $styles) : array<string|int, mixed>
Parameters
- $parsed_blocks : array<string|int, mixed>
-
Parsed blocks of the email.
- $layout : array{contentSize: string}
-
Layout of the email.
- $styles : array{spacing: array{padding: array{bottom: string, left: string, right: string, top: string}, blockGap: string}}
-
Styles of the email.
Return values
array<string|int, mixed> —copy_typography_from_parent()
Copy typography styles from parent to children
private
copy_typography_from_parent(array<string|int, mixed> $children, array<string|int, mixed> $parent_block) : array<string|int, mixed>
Parameters
- $children : array<string|int, mixed>
-
List of children blocks.
- $parent_block : array<string|int, mixed>
-
Parent block.
Return values
array<string|int, mixed> —filterStyles()
Filter styles to only include typography styles
private
filterStyles(array<string|int, mixed> $styles) : array<string|int, mixed>
Parameters
- $styles : array<string|int, mixed>
-
List of styles.
Return values
array<string|int, mixed> —preprocess_parent()
Preprocess parent block
private
preprocess_parent(array<string|int, mixed> $block) : array<string|int, mixed>
Parameters
- $block : array<string|int, mixed>
-
Block to preprocess.
Return values
array<string|int, mixed> —set_defaults_from_theme()
Set default values from theme
private
set_defaults_from_theme(array<string|int, mixed> $block) : array<string|int, mixed>
Parameters
- $block : array<string|int, mixed>
-
Block to set defaults for.