You are here

protected function ComponentDiscovery::getProfile in Lightning Core 8.4

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

Returns an extension object for the Lightning profile.

Return value

\Drupal\Core\Extension\Extension The Lightning profile extension object.

Throws

\RuntimeException If the Lightning profile is not found in the system.

File

src/ComponentDiscovery.php, line 58

Class

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

Namespace

Drupal\lightning_core

Code

protected function getProfile() {
  if (empty($this->profile)) {
    $profiles = $this->discovery
      ->scan('profile');
    if (empty($profiles['lightning'])) {
      throw new \RuntimeException('Lightning profile not found.');
    }
    $this->profile = $profiles['lightning'];
  }
  return $this->profile;
}