class FontWeight
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Theme/Plugin/DesignTokenValue/FontWeight.php \Drupal\Core\Theme\Plugin\DesignTokenValue\FontWeight
Font weight design token value.
Attributes
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\DependencyInjection\AutowiredInstanceTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
- class \Drupal\Core\Plugin\ConfigurablePluginBase implements \Drupal\Component\Plugin\ConfigurableInterface uses \Drupal\Core\Plugin\ConfigurableTrait extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Theme\DesignToken\DesignTokenValuePluginBase implements \Drupal\Core\Theme\DesignToken\DesignTokenValueInterface, \Drupal\Core\Plugin\ContainerFactoryPluginInterface extends \Drupal\Core\Plugin\ConfigurablePluginBase
- class \Drupal\Core\Theme\Plugin\DesignTokenValue\FontWeight extends \Drupal\Core\Theme\DesignToken\DesignTokenValuePluginBase
- class \Drupal\Core\Theme\DesignToken\DesignTokenValuePluginBase implements \Drupal\Core\Theme\DesignToken\DesignTokenValueInterface, \Drupal\Core\Plugin\ContainerFactoryPluginInterface extends \Drupal\Core\Plugin\ConfigurablePluginBase
- class \Drupal\Core\Plugin\ConfigurablePluginBase implements \Drupal\Component\Plugin\ConfigurableInterface uses \Drupal\Core\Plugin\ConfigurableTrait extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\DependencyInjection\AutowiredInstanceTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of FontWeight
4 files declare their use of FontWeight
- DesignTokenPluginManagerTest.php in core/
tests/ Drupal/ Tests/ Core/ Theme/ DesignToken/ DesignTokenPluginManagerTest.php - DesignTokenValuePluginManagerKernelTest.php in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ DesignToken/ DesignTokenValuePluginManagerKernelTest.php - FontWeightTest.php in core/
tests/ Drupal/ Tests/ Core/ Theme/ DesignToken/ Plugin/ FontWeightTest.php - TypographyTest.php in core/
tests/ Drupal/ Tests/ Core/ Theme/ DesignToken/ Plugin/ TypographyTest.php
15 string references to 'FontWeight'
- DesignTokenConfigEntityKernelTest::testConfigSchema in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ DesignToken/ DesignTokenConfigEntityKernelTest.php - Tests config schema.
- DesignTokenConfigEntityKernelTest::testInvalidConfigSchema in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ DesignToken/ DesignTokenConfigEntityKernelTest.php - Tests invalid config schema.
- DesignTokenPluginManagerKernelTest::testDetectedPlugins in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ DesignToken/ DesignTokenPluginManagerKernelTest.php - Tests that plugins can be provided by YAML files.
- DesignTokenPluginManagerTest::getValuePlugins in core/
tests/ Drupal/ Tests/ Core/ Theme/ DesignToken/ DesignTokenPluginManagerTest.php - Fake Design token value plugin instances.
- DesignTokenPluginManagerTest::providerExtractDefinitions in core/
tests/ Drupal/ Tests/ Core/ Theme/ DesignToken/ DesignTokenPluginManagerTest.php - Data provider for ::testExtractDefinitions().
File
-
core/
lib/ Drupal/ Core/ Theme/ Plugin/ DesignTokenValue/ FontWeight.php, line 15
Namespace
Drupal\Core\Theme\Plugin\DesignTokenValueView source
class FontWeight extends DesignTokenValuePluginBase {
/**
* The font weight value.
*/
protected int $value;
/**
* {@inheritdoc}
*/
public function defaultConfiguration() : array {
return [
// 0 is not an authorized value, this forces to set an authorized value.
'value' => 0,
] + parent::defaultConfiguration();
}
/**
* {@inheritdoc}
*/
public function setConfiguration(array $configuration) : static {
parent::setConfiguration($configuration);
if ($this->configuration['value'] instanceof FontWeightAlias) {
$this->value = $this->configuration['value']
->value();
return $this;
}
if (is_string($this->configuration['value'])) {
$this->value = FontWeightAlias::from($this->configuration['value'])
->value();
return $this;
}
$this->value = (int) $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 | |
| FontWeight::$value | protected | property | The font weight value. | ||
| FontWeight::defaultConfiguration | public | function | Gets default configuration for this plugin. | Overrides ConfigurableTrait::defaultConfiguration | |
| FontWeight::setConfiguration | public | function | Sets the configuration for this plugin instance. | Overrides ConfigurableTrait::setConfiguration | |
| FontWeight::toCss | public | function | Exports as CSS value. | Overrides DesignTokenValueInterface::toCss | |
| FontWeight::toDtcg | public | function | Exports as DTCG. | Overrides DesignTokenValueInterface::toDtcg | |
| MessengerTrait::$messenger | protected | property | The messenger. | 27 | |
| MessengerTrait::messenger | public | function | Gets the messenger. | 27 | |
| MessengerTrait::setMessenger | public | function | Sets the messenger. | ||
| 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.