function AttributeClassDiscovery::hasMissingDependencies

Same name in this branch
  1. main core/lib/Drupal/Core/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Core\Plugin\Discovery\AttributeClassDiscovery::hasMissingDependencies()
Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Core\Plugin\Discovery\AttributeClassDiscovery::hasMissingDependencies()
  2. 11.x core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery::hasMissingDependencies()

Whether the plugin definition has missing dependencies.

Parameters

array<string, array<class-string>> $dependencies: An array of dependencies' class names or namespaces, keyed by type.

Return value

bool TRUE if any dependencies are missing. FALSE otherwise.

File

core/lib/Drupal/Component/Plugin/Discovery/AttributeClassDiscovery.php, line 328

Class

AttributeClassDiscovery
Defines a discovery mechanism to find plugins with attributes.

Namespace

Drupal\Component\Plugin\Discovery

Code

protected function hasMissingDependencies(array $dependencies) : bool {
  foreach ($dependencies as $type_dependencies) {
    foreach ($type_dependencies as $dependency) {
      $namespace = $this->getTwoLevelNamespace($dependency);
      if (!str_starts_with($namespace, 'Drupal')) {
        // Not checking non-Drupal dependencies.
        continue;
      }
      if (!in_array($namespace, $this->rootTwoLevelNamespaces)) {
        return TRUE;
      }
    }
  }
  return FALSE;
}

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