function TermRouteContext::getAvailableContexts

Same name in other branches
  1. 10 core/modules/taxonomy/src/ContextProvider/TermRouteContext.php \Drupal\taxonomy\ContextProvider\TermRouteContext::getAvailableContexts()
  2. 11.x core/modules/taxonomy/src/ContextProvider/TermRouteContext.php \Drupal\taxonomy\ContextProvider\TermRouteContext::getAvailableContexts()

Overrides ContextProviderInterface::getAvailableContexts

File

core/modules/taxonomy/src/ContextProvider/TermRouteContext.php, line 70

Class

TermRouteContext
Sets the current taxonomy term as a context on taxonomy term routes.

Namespace

Drupal\taxonomy\ContextProvider

Code

public function getAvailableContexts() {
    $context = EntityContext::fromEntityTypeId('taxonomy_term', $this->t('Term from URL'));
    return [
        'taxonomy_term' => $context,
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.