TypedConfigManager::getFallbackName
protected function TypedConfigManager::getFallbackName
protected TypedConfigManager::getFallbackName($name)
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. Returns null if there is no schema name to fallback to. For example, breakpoint.breakpoint.module.toolbar.narrow will check for definitions in the following order: breakpoint.breakpoint.module.toolbar.* breakpoint.breakpoint.module.*.* breakpoint.breakpoint.module.* breakpoint.breakpoint.*.*.* breakpoint.breakpoint.* breakpoint.*.*.*.* breakpoint.* Colons are also used, for example, block.settings.system_menu_block:footer will check for definitions in the following order: block.settings.system_menu_block:* block.settings.*:* block.settings.* block.*.*:* block.*
File
- core/lib/Drupal/Core/Config/TypedConfigManager.php, line 228
Class
- TypedConfigManager
- Manages config schema type plugins.
Namespace
Drupal\Core\ConfigCode
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); } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!TypedConfigManager.php/function/TypedConfigManager::getFallbackName/8.1.x