You are here

public function ComponentDiscovery::getAll in Lightning Core 8.5

Same name and namespace in other branches
  1. 8.3 src/ComponentDiscovery.php \Drupal\lightning_core\ComponentDiscovery::getAll()
  2. 8.4 src/ComponentDiscovery.php \Drupal\lightning_core\ComponentDiscovery::getAll()

Returns extension objects for all Lightning components.

Return value

\Drupal\Core\Extension\Extension[] Array of extension objects for all Lightning components.

2 calls to ComponentDiscovery::getAll()
ComponentDiscovery::getMainComponents in src/ComponentDiscovery.php
Returns extension objects for all main Lightning components.
ComponentDiscovery::getSubComponents in src/ComponentDiscovery.php
Returns extension object for all Lightning sub-components.

File

src/ComponentDiscovery.php, line 76

Class

ComponentDiscovery
Helper object to locate Lightning components and sub-components.

Namespace

Drupal\lightning_core

Code

public function getAll() {
  if (is_null($this->components)) {
    $identifier = self::COMPONENT_PREFIX;
    $filter = function (Extension $module) use ($identifier) {
      return strpos($module
        ->getName(), $identifier) === 0;
    };
    $this->components = array_filter($this->discovery
      ->scan('module'), $filter);
  }
  return $this->components;
}