You are here

protected function Number::getElementDefinition in SCSS Compiler 1.0.x

Gets data definition object for contained element.

Parameters

int|string $key: Property name or index of the element.

Return value

\Drupal\Core\TypedData\DataDefinitionInterface

Overrides ArrayElement::getElementDefinition

File

src/Config/Schema/Number.php, line 24

Class

Number
A config schema type used to represent a Sass number.

Namespace

Drupal\compiler_scss\Config\Schema

Code

protected function getElementDefinition($key) {
  $value = $this->value[$key] ?? NULL;
  $definition = [];
  $properties = $this
    ->getDataDefinition()
    ->getPropertyDefinitions();
  if (array_key_exists($key, $properties)) {
    $definition = $properties[$key]
      ->toArray();
  }
  return $this
    ->buildDataDefinition($definition, $value, $key);
}