public function PathautoPattern::getContexts in Pathauto 8
Returns the contexts of this pattern.
Return value
\Drupal\Core\Plugin\Context\ContextInterface[]
Overrides PathautoPatternInterface::getContexts
1 call to PathautoPattern::getContexts()
- PathautoPattern::applies in src/
Entity/ PathautoPattern.php  - Determines if this pattern can apply a given object.
 
File
- src/
Entity/ PathautoPattern.php, line 231  
Class
- PathautoPattern
 - Defines the Pathauto pattern entity.
 
Namespace
Drupal\pathauto\EntityCode
public function getContexts() {
  $contexts = $this
    ->getAliasType()
    ->getContexts();
  foreach ($this
    ->getRelationships() as $token => $definition) {
    /** @var \Drupal\ctools\TypedDataResolver $resolver */
    $resolver = \Drupal::service('ctools.typed_data.resolver');
    $context = $resolver
      ->convertTokenToContext($token, $contexts);
    $context_definition = $context
      ->getContextDefinition();
    if (!empty($definition['label'])) {
      $context_definition
        ->setLabel($definition['label']);
    }
    $contexts[$token] = $context;
  }
  return $contexts;
}