interface ContextRepositoryInterface (View source)

Offers a global context repository.

Provides a list of all available contexts, which is mostly useful for configuration on forms, as well as a method to get the concrete contexts with their values, given a list of fully qualified context IDs.

Methods

getRuntimeContexts(array $context_ids)

Gets runtime context values for the given context IDs.

getAvailableContexts()

Gets all available contexts for the purposes of configuration.

Details

ContextInterface[] getRuntimeContexts(array $context_ids)

Gets runtime context values for the given context IDs.

Given that context providers might not return contexts for the given context IDs, it is also not guaranteed that the context repository returns contexts for all specified IDs.

Parameters

array $context_ids

Fully qualified context IDs, which looks like @{service_id}:{unqualified_context_id}, so for example node.node_route_context:node.

Return Value

ContextInterface[]

The determined contexts, keyed by the fully qualified context ID.

ContextInterface[] getAvailableContexts()

Gets all available contexts for the purposes of configuration.

Return Value

ContextInterface[]

All available contexts.