function LazyContextRepository::getAvailableContexts

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php \Drupal\Core\Plugin\Context\LazyContextRepository::getAvailableContexts()
  2. 8.9.x core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php \Drupal\Core\Plugin\Context\LazyContextRepository::getAvailableContexts()
  3. 11.x core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php \Drupal\Core\Plugin\Context\LazyContextRepository::getAvailableContexts()

File

core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php, line 86

Class

LazyContextRepository
Provides a context repository which uses context provider services.

Namespace

Drupal\Core\Plugin\Context

Code

public function getAvailableContexts() {
    $contexts = [];
    foreach ($this->contextProviderServiceIDs as $service_id) {
        $contexts_by_service = $this->container
            ->get($service_id)
            ->getAvailableContexts();
        foreach ($contexts_by_service as $unqualified_context_id => $context) {
            $context_id = '@' . $service_id . ':' . $unqualified_context_id;
            $contexts[$context_id] = $context;
        }
    }
    return $contexts;
}

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