You are here

public function UserRouteContext::getAvailableContexts in Open Social 8.9

Same name and namespace in other branches
  1. 8 modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  2. 8.2 modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  3. 8.3 modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  4. 8.4 modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  5. 8.5 modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  6. 8.6 modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  7. 8.7 modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  8. 8.8 modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  9. 10.3.x modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  10. 10.0.x modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  11. 10.1.x modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()
  12. 10.2.x modules/social_features/social_user/src/ContextProvider/UserRouteContext.php \Drupal\social_user\ContextProvider\UserRouteContext::getAvailableContexts()

Gets all available contexts for the purposes of configuration.

When a context aware plugin is being configured, the configuration UI must know which named contexts are potentially available, but does not care about the value, since the value can be different for each request, and might not be available at all during the configuration UI's request.

For example:

// During configuration, there is no specific node to pass as context.
// However, inform the system that a context named 'node' is
// available, and provide its definition, so that context aware plugins
// can be configured to use it. When the plugin, for example a block,
// needs to evaluate the context, the value of this context will be
// supplied by getRuntimeContexts().
$context = EntityContext::fromEntityTypeId('node');
return [
  'node' => $context,
];

Return value

\Drupal\Core\Plugin\Context\ContextInterface[] All available contexts keyed by the unqualified context ID.

Overrides ContextProviderInterface::getAvailableContexts

See also

\Drupal\Core\Plugin\Context\ContextProviderInterface::getRuntimeContext()

File

modules/social_features/social_user/src/ContextProvider/UserRouteContext.php, line 99

Class

UserRouteContext
Class UserRouteContext.

Namespace

Drupal\social_user\ContextProvider

Code

public function getAvailableContexts() {
  return $this
    ->getRuntimeContexts([]);
}