WooCommerce Code Reference

Theme_Controller
in package

E-mail editor works with own theme.json which defines settings for the editor and styles for the e-mail.

This class is responsible for accessing data defined by the theme.json.

Table of Contents

$base_theme  : WP_Theme_JSON
Base theme loaded from a file in the package directory.
$core_theme  : WP_Theme_JSON
Core theme loaded from the WordPress core.
$user_theme  : User_Theme
User theme contains user custom styles and settings
__construct()  : mixed
Theme_Controller constructor.
get_base_theme()  : WP_Theme_JSON
Gets combined theme data from the core and base theme.
get_layout_settings()  : array{contentSize: string, wideSize: string, allowEditing?: bool, allowCustomContentAndWideSize?: bool}
Get layout settings from the theme.
get_settings()  : array<string|int, mixed>
Get settings from the theme.
get_styles()  : array{spacing: array{blockGap: string, padding: array{bottom: string, left: string, right: string, top: string}}, color: array{background: string}, typography: array{fontFamily: string}}
Get styles for the e-mail.
get_stylesheet_for_rendering()  : string
Get stylesheet for rendering.
get_stylesheet_from_context()  : string
Get stylesheet from context.
get_theme()  : WP_Theme_JSON
Gets combined theme data from the core and base theme, merged with the user .
get_variables_values_map()  : array<string|int, mixed>
Returns the map of CSS variables and their values from the theme.
translate_slug_to_color()  : string
Translate color slug to color.
translate_slug_to_font_size()  : string
Translate font family slug to font family name.
recursive_extract_preset_variables()  : array<string|int, mixed>
Replace preset variables with their values.
recursive_replace_presets()  : array<string|int, mixed>
Replace preset variables with their values.

Properties

Methods

get_layout_settings()

Get layout settings from the theme.

public get_layout_settings() : array{contentSize: string, wideSize: string, allowEditing?: bool, allowCustomContentAndWideSize?: bool}
Return values
array{contentSize: string, wideSize: string, allowEditing?: bool, allowCustomContentAndWideSize?: bool}

get_styles()

Get styles for the e-mail.

public get_styles() : array{spacing: array{blockGap: string, padding: array{bottom: string, left: string, right: string, top: string}}, color: array{background: string}, typography: array{fontFamily: string}}
Return values
array{spacing: array{blockGap: string, padding: array{bottom: string, left: string, right: string, top: string}}, color: array{background: string}, typography: array{fontFamily: string}}

get_stylesheet_for_rendering()

Get stylesheet for rendering.

public get_stylesheet_for_rendering([WP_Post|null $post = null ][, WP_Block_Template|null $template = null ]) : string
Parameters
$post : WP_Post|null = null

Post object.

$template : WP_Block_Template|null = null

Template object.

Return values
string

get_stylesheet_from_context()

Get stylesheet from context.

public get_stylesheet_from_context(string $context[, array<string|int, mixed> $options = array() ]) : string
Parameters
$context : string

Context.

$options : array<string|int, mixed> = array()

Options.

Return values
string

recursive_extract_preset_variables()

Replace preset variables with their values.

private recursive_extract_preset_variables(array<string|int, mixed> $styles) : array<string|int, mixed>
Parameters
$styles : array<string|int, mixed>

Styles array.

Return values
array<string|int, mixed>

recursive_replace_presets()

Replace preset variables with their values.

private recursive_replace_presets(array<string|int, mixed> $values, array<string|int, mixed> $presets) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>

Styles array.

$presets : array<string|int, mixed>

Presets array.

Return values
array<string|int, mixed>