Automattic\WooCommerce\EmailEditor\Engine
Theme_Controller::translate_slug_to_color
Translate color slug to color.
Method of the class: Theme_Controller{}
No Hooks.
Returns
String.
Usage
$Theme_Controller = new Theme_Controller(); $Theme_Controller->translate_slug_to_color( $color_slug ): string;
- $color_slug(string) (required)
- Color slug.
Theme_Controller::translate_slug_to_color() Theme Controller::translate slug to color code WC 10.8.1
public function translate_slug_to_color( string $color_slug ): string {
$settings = $this->get_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;
}