Blocks_Width_Preprocessor
in package
implements
Preprocessor
This class sets the width of the blocks based on the layout width or column count.
The final width in pixels is stored in the email_attrs array because we would like to avoid changing the original attributes.
Interfaces, Classes and Traits
- Preprocessor
- Interface Preprocessor
Table of Contents
- preprocess() : array<string|int, mixed>
- Method to preprocess the content before rendering
- add_missing_column_widths() : array<string|int, mixed>
- Add missing column widths
- convert_width_to_pixels() : float
- Convert width to pixels
- parse_number_from_string_with_pixels() : float
- Parse number from string with pixels
Methods
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> —add_missing_column_widths()
Add missing column widths
private
add_missing_column_widths(array<string|int, mixed> $columns, float $columns_width) : array<string|int, mixed>
Parameters
- $columns : array<string|int, mixed>
-
Columns.
- $columns_width : float
-
Columns width.
Return values
array<string|int, mixed> —convert_width_to_pixels()
Convert width to pixels
private
convert_width_to_pixels(string $current_width, float $layout_width) : float
Parameters
- $current_width : string
-
Current width.
- $layout_width : float
-
Layout width.
Return values
float —parse_number_from_string_with_pixels()
Parse number from string with pixels
private
parse_number_from_string_with_pixels(string $value) : float
Parameters
- $value : string
-
Value with pixels.