trait LayoutBuilderContextTrait (View source)

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

Properties

protected ContextRepositoryInterface $contextRepository

The context repository.

Methods

contextRepository()

Gets the context repository service.

getAvailableContexts(SectionStorageInterface $section_storage) deprecated

Provides all available contexts, both global and section_storage-specific.

array
getPopulatedContexts(SectionStorageInterface $section_storage)

Returns all populated contexts, both global and section-storage-specific.

Details

protected ContextRepositoryInterface contextRepository()

Gets the context repository service.

Return Value

ContextRepositoryInterface

The context repository service.

protected ContextInterface[] getAvailableContexts(SectionStorageInterface $section_storage) deprecated

deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\layout_builder\Context\LayoutBuilderContextTrait::getPopulatedContexts() instead.

Provides all available contexts, both global and section_storage-specific.

Parameters

SectionStorageInterface $section_storage

The section storage.

Return Value

ContextInterface[]

The array of context objects.

See also

https://www.drupal.org/node/3195121

protected array getPopulatedContexts(SectionStorageInterface $section_storage)

Returns all populated contexts, both global and section-storage-specific.

Parameters

SectionStorageInterface $section_storage

The section storage.

Return Value

array

The array of context objects.