public function ViewmodepagePattern::getContexts in View Mode Page 4.0.x
Same name and namespace in other branches
- 8.3 src/Entity/ViewmodepagePattern.php \Drupal\view_mode_page\Entity\ViewmodepagePattern::getContexts()
- 3.2.x src/Entity/ViewmodepagePattern.php \Drupal\view_mode_page\Entity\ViewmodepagePattern::getContexts()
Returns the contexts of this pattern.
Return value
\Drupal\Core\Plugin\Context\ContextInterface[] Return the context interface.
Overrides ViewmodepagePatternInterface::getContexts
1 call to ViewmodepagePattern::getContexts()
- ViewmodepagePattern::applies in src/
Entity/ ViewmodepagePattern.php - Determines if this pattern can apply a given object.
File
- src/
Entity/ ViewmodepagePattern.php, line 323
Class
- ViewmodepagePattern
- Defines the Viewmodepage pattern entity.
Namespace
Drupal\view_mode_page\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;
}