Validates the configuration object name.
\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(format_string('Missing namespace in Config object name @name.', array(
'@name' => $name,
)));
}
// The name must be shorter than Config::MAX_NAME_LENGTH characters.
if (strlen($name) > self::MAX_NAME_LENGTH) {
throw new ConfigNameException(format_string('Config object name @name exceeds maximum allowed length of @length characters.', array(
'@name' => $name,
'@length' => self::MAX_NAME_LENGTH,
)));
}
// The name must not contain any of the following characters:
// : ? * < > " ' / \
if (preg_match('/[:?*<>"\'\\/\\\\]/', $name)) {
throw new ConfigNameException(format_string('Invalid character in Config object name @name.', array(
'@name' => $name,
)));
}
}