public function SchemaDiscovery::getDefinition

Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinition().

Overrides DiscoveryInterface::getDefinition

File

drupal/core/lib/Drupal/Core/Config/Schema/SchemaDiscovery.php, line 47
Contains \Drupal\Config\Schema\SchemaDiscovery.

Class

SchemaDiscovery
A discovery mechanism that reads plugin definitions from schema data in YAML format.

Namespace

Drupal\Core\Config\Schema

Code

public function getDefinition($base_plugin_id) {
  if (isset($this->definitions[$base_plugin_id])) {
    $type = $base_plugin_id;
  }
  elseif (strpos($base_plugin_id, '.') && ($name = $this
    ->getFallbackName($base_plugin_id))) {

    // Found a generic name, replacing the last element by '*'.
    $type = $name;
  }
  else {

    // If we don't have definition, return the 'default' element.
    // This should map to 'undefined' type by default, unless overridden.
    $type = 'default';
  }
  $definition = $this->definitions[$type];

  // Check whether this type is an extension of another one and compile it.
  if (isset($definition['type'])) {
    $merge = $this
      ->getDefinition($definition['type']);
    $definition = NestedArray::mergeDeep($merge, $definition);

    // Unset type so we try the merge only once per type.
    unset($definition['type']);
    $this->definitions[$type] = $definition;
  }
  return $definition;
}