protected function SchemaDiscovery::getFallbackName

Gets fallback metadata name.

Parameters

string $name: Configuration name or key.

Return value

null|string Same name with the last part(s) replaced by the filesystem marker. for example, breakpoint.breakpoint.module.toolbar.narrow check for definition in below order: breakpoint.breakpoint.module.toolbar.* breakpoint.breakpoint.module.*.* breakpoint.breakpoint.*.*.* breakpoint.*.*.*.* Returns null, if no matching element.

1 call to SchemaDiscovery::getFallbackName()

File

drupal/core/lib/Drupal/Core/Config/Schema/SchemaDiscovery.php, line 108
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

protected function getFallbackName($name) {

  // Check for definition of $name with filesystem marker.
  $replaced = preg_replace('/(\\.[^\\.]+)([\\.\\*]*)$/', '.*\\2', $name);
  if ($replaced != $name) {
    if (isset($this->definitions[$replaced])) {
      return $replaced;
    }
    else {

      // No definition for this level(for example, breakpoint.breakpoint.*),
      // check for next level (which is, breakpoint.*.*).
      return self::getFallbackName($replaced);
    }
  }
}