Number.php
Same filename in this branch
Same filename and directory in other branches
- 10 core/lib/Drupal/Core/Render/Element/Number.php
- 10 core/lib/Drupal/Component/Utility/Number.php
- 9 core/lib/Drupal/Core/Render/Element/Number.php
- 9 core/lib/Drupal/Component/Utility/Number.php
- 8.9.x core/lib/Drupal/Core/Render/Element/Number.php
- 8.9.x core/lib/Drupal/Component/Utility/Number.php
- main core/lib/Drupal/Core/Render/Element/Number.php
- main core/lib/Drupal/Component/Utility/Number.php
Namespace
Drupal\Core\Theme\Plugin\DesignTokenValueFile
-
core/
lib/ Drupal/ Core/ Theme/ Plugin/ DesignTokenValue/ Number.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Core\Theme\Plugin\DesignTokenValue;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Theme\DesignToken\Attribute\DesignTokenValue;
use Drupal\Core\Theme\DesignToken\DesignTokenValuePluginBase;
/**
* Number design token value.
*/
class Number extends DesignTokenValuePluginBase {
/**
* Numbers can be positive, negative and have fractions.
*/
protected int|float $value;
/**
* {@inheritdoc}
*/
public function defaultConfiguration() : array {
return [
'value' => 0,
] + parent::defaultConfiguration();
}
/**
* {@inheritdoc}
*/
public function setConfiguration(array $configuration) : static {
parent::setConfiguration($configuration);
$this->value = $this->configuration['value'];
return $this;
}
/**
* {@inheritdoc}
*/
public function toDtcg() : mixed {
return $this->value;
}
/**
* {@inheritdoc}
*/
public function toCss() : string {
return (string) $this->value;
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| Number | Number design token value. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.