ContextRepositoryInterface.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Drupal\Core\Plugin\Context;
  3. /**
  4. * Offers a global context repository.
  5. *
  6. * Provides a list of all available contexts, which is mostly useful for
  7. * configuration on forms, as well as a method to get the concrete contexts with
  8. * their values, given a list of fully qualified context IDs.
  9. *
  10. * @see \Drupal\Core\Plugin\Context\ContextProviderInterface
  11. */
  12. interface ContextRepositoryInterface {
  13. /**
  14. * Gets runtime context values for the given context IDs.
  15. *
  16. * Given that context providers might not return contexts for the given
  17. * context IDs, it is also not guaranteed that the context repository returns
  18. * contexts for all specified IDs.
  19. *
  20. * @param string[] $context_ids
  21. * Fully qualified context IDs, which looks like
  22. * @{service_id}:{unqualified_context_id}, so for example
  23. * node.node_route_context:node.
  24. *
  25. * @return \Drupal\Core\Plugin\Context\ContextInterface[]
  26. * The determined contexts, keyed by the fully qualified context ID.
  27. */
  28. public function getRuntimeContexts(array $context_ids);
  29. /**
  30. * Gets all available contexts for the purposes of configuration.
  31. *
  32. * @return \Drupal\Core\Plugin\Context\ContextInterface[]
  33. * All available contexts.
  34. */
  35. public function getAvailableContexts();
  36. }