Automattic\WooCommerce\EmailEditor\Engine
Site_Style_Sync_Controller::convert_element_style
Convert individual element style to email format
Method of the class: Site_Style_Sync_Controller{}
No Hooks.
Returns
Array. Email-compatible element style.
Usage
// private - for code of main (parent) class only $result = $this->convert_element_style( $element_style, $element_name ): array;
- $element_style(array) (required)
- Site element style.
- $element_name(string)
- Element name (e.g.,
'h1','h2', 'button').
Default:''
Site_Style_Sync_Controller::convert_element_style() Site Style Sync Controller::convert element style code WC 10.9.3
private function convert_element_style( array $element_style, string $element_name = '' ): array {
$email_element = array();
// Convert typography if present.
if ( isset( $element_style['typography'] ) ) {
$email_element['typography'] = $this->convert_typography_styles( $element_style['typography'], $element_name );
}
// Convert color if present.
if ( isset( $element_style['color'] ) ) {
$email_element['color'] = $this->convert_color_styles( $element_style['color'] );
}
// Convert spacing if present.
if ( isset( $element_style['spacing'] ) ) {
$email_element['spacing'] = $this->convert_spacing_styles( $element_style['spacing'] );
}
return $email_element;
}