function Sequence::getElementDefinition

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Config/Schema/Sequence.php \Drupal\Core\Config\Schema\Sequence::getElementDefinition()
  2. 8.9.x core/lib/Drupal/Core/Config/Schema/Sequence.php \Drupal\Core\Config\Schema\Sequence::getElementDefinition()
  3. 11.x core/lib/Drupal/Core/Config/Schema/Sequence.php \Drupal\Core\Config\Schema\Sequence::getElementDefinition()

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

core/lib/Drupal/Core/Config/Schema/Sequence.php, line 25

Class

Sequence
Defines a configuration element of type Sequence.

Namespace

Drupal\Core\Config\Schema

Code

protected function getElementDefinition($key) {
  $value = $this->value[$key] ?? NULL;
  // @todo Remove BC layer for sequence with hyphen in front. https://www.drupal.org/node/2444979
  $definition = [];
  if (isset($this->definition['sequence'][0])) {
    $definition = $this->definition['sequence'][0];
    $bc_sequence_location = $this->getPropertyPath();
    @trigger_error("The definition for the '{$bc_sequence_location}' sequence declares the type of its items in a way that is deprecated in drupal:8.0.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/2442603", E_USER_DEPRECATED);
  }
  elseif ($this->definition['sequence']) {
    $definition = $this->definition['sequence'];
  }
  return $this->buildDataDefinition($definition, $value, $key);
}

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