You are here

interface ContextRepositoryInterface in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Plugin/Context/ContextRepositoryInterface.php \Drupal\Core\Plugin\Context\ContextRepositoryInterface

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.

Hierarchy

Expanded class hierarchy of ContextRepositoryInterface

All classes that implement ContextRepositoryInterface

See also

\Drupal\Core\Plugin\Context\ContextProviderInterface

2 files declare their use of ContextRepositoryInterface
BlockAccessControlHandler.php in core/modules/block/src/BlockAccessControlHandler.php
Contains \Drupal\block\BlockAccessControlHandler.
BlockForm.php in core/modules/block/src/BlockForm.php
Contains \Drupal\block\BlockForm.

File

core/lib/Drupal/Core/Plugin/Context/ContextRepositoryInterface.php, line 19
Contains \Drupal\Core\Plugin\Context\ContextRepositoryInterface.

Namespace

Drupal\Core\Plugin\Context
View source
interface ContextRepositoryInterface {

  /**
   * 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.
   *
   * @param string[] $context_ids
   *   Fully qualified context IDs, which looks like
   *   @{service_id}:{unqualified_context_id}, so for example
   *   node.node_route_context:node.
   *
   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
   *   The determined contexts, keyed by the fully qualified context ID.
   */
  public function getRuntimeContexts(array $context_ids);

  /**
   * Gets all available contexts for the purposes of configuration.
   *
   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
   *   All available contexts.
   */
  public function getAvailableContexts();

}

Members

Namesort descending Modifiers Type Description Overrides
ContextRepositoryInterface::getAvailableContexts public function Gets all available contexts for the purposes of configuration. 1
ContextRepositoryInterface::getRuntimeContexts public function Gets runtime context values for the given context IDs. 1