class Number

Same name in this branch
  1. main core/lib/Drupal/Core/Render/Element/Number.php \Drupal\Core\Render\Element\Number
  2. main core/lib/Drupal/Component/Utility/Number.php \Drupal\Component\Utility\Number
Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Render/Element/Number.php \Drupal\Core\Render\Element\Number
  2. 11.x core/lib/Drupal/Component/Utility/Number.php \Drupal\Component\Utility\Number
  3. 10 core/lib/Drupal/Core/Render/Element/Number.php \Drupal\Core\Render\Element\Number
  4. 10 core/lib/Drupal/Component/Utility/Number.php \Drupal\Component\Utility\Number
  5. 9 core/lib/Drupal/Core/Render/Element/Number.php \Drupal\Core\Render\Element\Number
  6. 9 core/lib/Drupal/Component/Utility/Number.php \Drupal\Component\Utility\Number
  7. 8.9.x core/lib/Drupal/Core/Render/Element/Number.php \Drupal\Core\Render\Element\Number
  8. 8.9.x core/lib/Drupal/Component/Utility/Number.php \Drupal\Component\Utility\Number
  9. 11.x core/lib/Drupal/Core/Theme/Plugin/DesignTokenValue/Number.php \Drupal\Core\Theme\Plugin\DesignTokenValue\Number

Number design token value.

Attributes

#[DesignTokenValue(id: 'number', label: new TranslatableMarkup('Number'))]

Hierarchy

Expanded class hierarchy of Number

6 files declare their use of Number
DesignTokenPluginManagerTest.php in core/tests/Drupal/Tests/Core/Theme/DesignToken/DesignTokenPluginManagerTest.php
DesignTokenTest.php in core/tests/Drupal/Tests/Core/Theme/DesignToken/DesignTokenTest.php
DesignTokenValuePluginManagerKernelTest.php in core/tests/Drupal/KernelTests/Core/Theme/DesignToken/DesignTokenValuePluginManagerKernelTest.php
GroupTest.php in core/tests/Drupal/Tests/Core/Theme/DesignToken/GroupTest.php
NumberTest.php in core/tests/Drupal/Tests/Core/Theme/DesignToken/Plugin/NumberTest.php

... See full list

74 string references to 'Number'
ClaroHooks::preprocessInput in core/themes/claro/src/Hook/ClaroHooks.php
Implements hook_preprocess_HOOK() for input.
ComponentValidator::getClassProps in core/lib/Drupal/Core/Theme/Component/ComponentValidator.php
Gets the props that are not JSON based.
ConfigEntityQueryTest::testTableSort in core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php
Tests sorting with tableSort on config entity queries.
ConfigEntityQueryTest::testTableSort in core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php
Tests sorting with tableSort on config entity queries.
config_test.schema.yml in core/modules/config/tests/config_test/config/schema/config_test.schema.yml
core/modules/config/tests/config_test/config/schema/config_test.schema.yml

... See full list

File

core/lib/Drupal/Core/Theme/Plugin/DesignTokenValue/Number.php, line 14

Namespace

Drupal\Core\Theme\Plugin\DesignTokenValue
View source
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;
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AutowiredInstanceTrait::createInstanceAutowired public static function Instantiates a new instance of the implementing class using autowiring.
AutowiredInstanceTrait::getAutowireArguments private static function Resolves arguments for a method using autowiring.
ConfigurablePluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct 6
ConfigurableTrait::$configuration protected property Configuration information passed into the plugin.
ConfigurableTrait::getConfiguration public function Gets this plugin's configuration. 3
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 2
DependencySerializationTrait::__wakeup public function 2
DesignTokenValuePluginBase::prepareConfiguration public static function Prepares configuration for plugin creation. Overrides DesignTokenValueInterface::prepareConfiguration
MessengerTrait::$messenger protected property The messenger. 27
MessengerTrait::messenger public function Gets the messenger. 27
MessengerTrait::setMessenger public function Sets the messenger.
Number::$value protected property Numbers can be positive, negative and have fractions.
Number::defaultConfiguration public function Gets default configuration for this plugin. Overrides ConfigurableTrait::defaultConfiguration
Number::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurableTrait::setConfiguration
Number::toCss public function Exports as CSS value. Overrides DesignTokenValueInterface::toCss
Number::toDtcg public function Exports as DTCG. Overrides DesignTokenValueInterface::toDtcg
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin ID.
PluginBase::create public static function Instantiates a new instance of the implementing class using autowiring. 70
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 2
PluginBase::getPluginId public function Gets the plugin ID of the plugin instance. Overrides PluginInspectionInterface::getPluginId
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language. 1

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