You are here

public function ComponentsInfo::isProtectedNamespace in Components! 8.2

Checks if the string is a default namespace that should not be overridden.

Protected namespaces are default namespaces that are maintained by Drupal core and owned by individual modules or themes. By default, default namespaces cannot be overridden; a module or theme can opt-in to having their namespace altered by using their name in the components.namespaces key of their .info.yml or by setting the components.allow_default_namespace_reuse key in their .info.yml.

@internal

Parameters

string $namespace: The namespace to check.

Return value

bool Whether the namespace is protected or not.

File

src/Template/ComponentsInfo.php, line 284

Class

ComponentsInfo
Loads info about components defined in themes or modules.

Namespace

Drupal\components\Template

Code

public function isProtectedNamespace(string $namespace) : bool {
  $this
    ->init();
  return isset($this->protectedNamespaces[$namespace]);
}