Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer
Rendering_Context::translate_slug_to_color
Translate color slug to color.
Method of the class: Rendering_Context{}
No Hooks.
Returns
String.
Usage
$Rendering_Context = new Rendering_Context(); $Rendering_Context->translate_slug_to_color( $color_slug ): string;
- $color_slug(string) (required)
- Color slug.
Rendering_Context::translate_slug_to_color() Rendering Context::translate slug to color code WC 10.8.1
public function translate_slug_to_color( string $color_slug ): string {
$settings = $this->get_theme_settings();
$color_definitions = array_merge(
$settings['color']['palette']['theme'] ?? array(),
$settings['color']['palette']['default'] ?? array()
);
foreach ( $color_definitions as $color_definition ) {
if ( $color_definition['slug'] === $color_slug ) {
return strtolower( $color_definition['color'] );
}
}
return $color_slug;
}