function Typography::toCss

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Theme/Plugin/DesignTokenValue/Typography.php \Drupal\Core\Theme\Plugin\DesignTokenValue\Typography::toCss()

Exports as CSS value.

Return value

string The CSS variable.

Overrides DesignTokenValueInterface::toCss

File

core/lib/Drupal/Core/Theme/Plugin/DesignTokenValue/Typography.php, line 118

Class

Typography
Typography design token value.

Namespace

Drupal\Core\Theme\Plugin\DesignTokenValue

Code

public function toCss() : string {
  // letterSpacing is not allowed in the font shortcut.
  return implode(' ', [
    $this->fontWeight
      ->toCss(),
    $this->fontSize
      ->toCss() . '/' . $this->lineHeight
      ->toCss(),
    $this->fontFamily
      ->toCss(),
  ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.