public static ConfigBase::validateName($name)
Validates the configuration object name.
string $name: The name of the configuration object.
\Drupal\Core\Config\ConfigNameException
Config::MAX_NAME_LENGTH
public static function validateName($name) { // The name must be namespaced by owner. if (strpos($name, '.') === FALSE) { throw new ConfigNameException("Missing namespace in Config object name $name."); } // The name must be shorter than Config::MAX_NAME_LENGTH characters. if (strlen($name) > self::MAX_NAME_LENGTH) { throw new ConfigNameException("Config object name $name exceeds maximum allowed length of " . static::MAX_NAME_LENGTH . " characters."); } // The name must not contain any of the following characters: // : ? * < > " ' / \ if (preg_match('/[:?*<>"\'\/\\\\]/', $name)) { throw new ConfigNameException("Invalid character in Config object name $name."); } }
© 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!ConfigBase.php/function/ConfigBase::validateName/8.1.x