protected function PageBlockDisplayVariant::getContextAsTokenData in Page Manager 8.4
Same name and namespace in other branches
- 8 src/Plugin/DisplayVariant/PageBlockDisplayVariant.php \Drupal\page_manager\Plugin\DisplayVariant\PageBlockDisplayVariant::getContextAsTokenData()
Returns available context as token data.
Return value
array An array with token data values keyed by token type.
1 call to PageBlockDisplayVariant::getContextAsTokenData()
- PageBlockDisplayVariant::renderPageTitle in src/
Plugin/ DisplayVariant/ PageBlockDisplayVariant.php - Renders the page title and replaces tokens.
File
- src/
Plugin/ DisplayVariant/ PageBlockDisplayVariant.php, line 308
Class
- PageBlockDisplayVariant
- Provides a variant plugin that simply contains blocks.
Namespace
Drupal\page_manager\Plugin\DisplayVariantCode
protected function getContextAsTokenData() {
$data = [];
foreach ($this
->getContexts() as $context) {
// @todo Simplify this when token and typed data types are unified in
// https://drupal.org/node/2163027.
if (strpos($context
->getContextDefinition()
->getDataType(), 'entity:') === 0) {
$token_type = substr($context
->getContextDefinition()
->getDataType(), 7);
if ($token_type == 'taxonomy_term') {
$token_type = 'term';
}
$data[$token_type] = $context
->getContextValue();
}
}
return $data;
}