function TypedConfigManager::getFallbackName

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/TypedConfigManager.php \Drupal\Core\Config\TypedConfigManager::getFallbackName()
  2. 8.9.x core/lib/Drupal/Core/Config/TypedConfigManager.php \Drupal\Core\Config\TypedConfigManager::getFallbackName()
  3. 10 core/lib/Drupal/Core/Config/TypedConfigManager.php \Drupal\Core\Config\TypedConfigManager::getFallbackName()

Gets fallback configuration schema name.

Parameters

string $name: Configuration name or key.

Return value

null|string The resolved schema name for the given configuration name or key.

2 calls to TypedConfigManager::getFallbackName()
TypedConfigManager::determineType in core/lib/Drupal/Core/Config/TypedConfigManager.php
Determines the typed config type for a plugin ID.
TypedConfigManager::findFallback in core/lib/Drupal/Core/Config/TypedConfigManager.php
Finds fallback configuration schema name.

File

core/lib/Drupal/Core/Config/TypedConfigManager.php, line 369

Class

TypedConfigManager
Manages config schema type plugins.

Namespace

Drupal\Core\Config

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. Collapse multiple wildcards to a single
            // wildcard to see if there is a greedy match. For example,
            // breakpoint.breakpoint.*.* becomes
            // breakpoint.breakpoint.*
            $one_star = preg_replace('/\\.([:\\.\\*]*)$/', '.*', $replaced);
            if ($one_star != $replaced && isset($this->definitions[$one_star])) {
                return $one_star;
            }
            // Check for next level. For example, if breakpoint.breakpoint.* has
            // been checked and no match found then check breakpoint.*.*
            return $this->getFallbackName($replaced);
        }
    }
}

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