Automattic\WooCommerce\EmailEditor\Engine

Theme_Controller::translate_slug_to_colorpublicWC 1.0

Translate color slug to color.

Метод класса: Theme_Controller{}

Хуков нет.

Возвращает

Строку.

Использование

$Theme_Controller = new Theme_Controller();
$Theme_Controller->translate_slug_to_color( $color_slug ): string;
$color_slug(строка) (обязательный)
Color slug.

Код Theme_Controller::translate_slug_to_color() WC 10.0.2

public function translate_slug_to_color( string $color_slug ): string {
	$settings          = $this->get_settings();
	$color_definitions = array_merge( $settings['color']['palette']['theme'], $settings['color']['palette']['default'] );
	foreach ( $color_definitions as $color_definition ) {
		if ( $color_definition['slug'] === $color_slug ) {
			return strtolower( $color_definition['color'] );
		}
	}
	return $color_slug;
}