You are here

protected static function ScssNumber::initializeUnits in SCSS Compiler 1.0.x

Initializes the unit options for this element.

1 call to ScssNumber::initializeUnits()
ScssNumber::getAllowedUnits in src/Element/ScssNumber.php
Get an associative array of allowed unit options, keyed by unit name.

File

src/Element/ScssNumber.php, line 293

Class

ScssNumber
A form element to represent Sass numbers with a unit.

Namespace

Drupal\compiler_scss\Element

Code

protected static function initializeUnits() {
  self::$units = [
    self::UNIT_ABSOLUTE => [
      'cm' => t('centimeters'),
      'in' => t('inches'),
      'mm' => t('millimeters'),
      'pc' => t('picas'),
      'pt' => t('points'),
      'px' => t('pixels'),
    ],
    self::UNIT_ANGLE => [
      'deg' => t('degrees'),
      'grad' => t('gradians'),
      'rad' => t('radians'),
      'turn' => t('turns'),
    ],
    self::UNIT_FREQUENCY => [
      'Hz' => t('hertz'),
      'kHz' => t('kilohertz'),
    ],
    self::UNIT_PERCENT => [
      '%' => t('percent'),
    ],
    self::UNIT_RELATIVE => [
      'rem' => t('× the root font size'),
      'em' => t('× the element font size'),
      'lh' => t('× the line height of the element'),
      'ex' => t('× the x-height of the element font'),
      'ch' => t('× the width of "0" in the element font'),
      'vh' => t('× 1% of the viewport height'),
      'vw' => t('× 1% of the viewport width'),
      'vmax' => t('× 1% of the larger viewport dimension'),
      'vmin' => t('× 1% of the smaller viewport dimension'),
    ],
    self::UNIT_RESOLUTION => [
      'dpcm' => t('dots per centimeter'),
      'dpi' => t('dots per inch'),
      'dppx' => t('dots per pixel'),
    ],
    self::UNIT_TIME => [
      'ms' => t('milliseconds'),
      's' => t('seconds'),
    ],
  ];
}