You are here

protected function LayoutBuilderContextTrait::contextRepository in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Context/LayoutBuilderContextTrait.php \Drupal\layout_builder\Context\LayoutBuilderContextTrait::contextRepository()
  2. 9 core/modules/layout_builder/src/Context/LayoutBuilderContextTrait.php \Drupal\layout_builder\Context\LayoutBuilderContextTrait::contextRepository()

Gets the context repository service.

Return value

\Drupal\Core\Plugin\Context\ContextRepositoryInterface The context repository service.

1 call to LayoutBuilderContextTrait::contextRepository()
LayoutBuilderContextTrait::getPopulatedContexts in core/modules/layout_builder/src/Context/LayoutBuilderContextTrait.php
Returns all populated contexts, both global and section-storage-specific.

File

core/modules/layout_builder/src/Context/LayoutBuilderContextTrait.php, line 26

Class

LayoutBuilderContextTrait
Provides a wrapper around getting contexts from a section storage object.

Namespace

Drupal\layout_builder\Context

Code

protected function contextRepository() {
  if (!$this->contextRepository) {
    $this->contextRepository = \Drupal::service('context.repository');
  }
  return $this->contextRepository;
}