function DesignToken::toCss
1 call to DesignToken::toCss()
- DesignTokenConfigEntityKernelTest::testToCss in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ DesignToken/ DesignTokenConfigEntityKernelTest.php - Tests CSS export.
File
-
core/
lib/ Drupal/ Core/ Theme/ Entity/ DesignToken.php, line 128
Class
- DesignToken
- Configuration entity.
Namespace
Drupal\Core\Theme\EntityCode
public static function toCss(array $tokens) : string {
// Regroup values by scope.
$scopes = [];
foreach ($tokens as $token) {
foreach ($token->getScopes() as $scope => $value) {
$scope = static::getCssScopeName($scope);
if (!isset($scopes[$scope])) {
$scopes[$scope] = [];
}
$scopes[$scope][$token->getCssVariableName()] = $value;
}
}
return static::getCssVariablesInlineCss($scopes);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.