public function ContextMapper::getContextValues in Page Manager 8
Same name and namespace in other branches
- 8.4 src/ContextMapper.php \Drupal\page_manager\ContextMapper::getContextValues()
Gathers the static context values.
Parameters
array[] $static_context_configurations: An array of static context configurations.
Return value
\Drupal\Component\Plugin\Context\ContextInterface[] An array of set context values, keyed by context name.
Overrides ContextMapperInterface::getContextValues
File
- src/
ContextMapper.php, line 40 - Contains \Drupal\page_manager\ContextMapper.
Class
- ContextMapper
- Maps context configurations to context objects.
Namespace
Drupal\page_managerCode
public function getContextValues(array $context_configurations) {
$contexts = [];
foreach ($context_configurations as $name => $context_configuration) {
$context_definition = new ContextDefinition($context_configuration['type'], $context_configuration['label']);
if (strpos($context_configuration['type'], 'entity:') === 0) {
$context = new EntityLazyLoadContext($context_definition, $this->entityRepository, $context_configuration['value']);
}
else {
$context = new Context($context_definition, $context_configuration['value']);
}
$contexts[$name] = $context;
}
return $contexts;
}