public function ConfigPagesType::getContextData in Config Pages 8.2
Same name and namespace in other branches
- 8.3 src/Entity/ConfigPagesType.php \Drupal\config_pages\Entity\ConfigPagesType::getContextData()
- 8 src/Entity/ConfigPagesType.php \Drupal\config_pages\Entity\ConfigPagesType::getContextData()
Provides the serialized context data.
Parameters
bool $fallback: Not count the context plugins.
Return value
string Return context data.
Throws
\Drupal\Component\Plugin\Exception\PluginException
File
- src/
Entity/ ConfigPagesType.php, line 114
Class
- ConfigPagesType
- Defines the config page type entity.
Namespace
Drupal\config_pages\EntityCode
public function getContextData($fallback = FALSE) {
$contextData = [];
if (!empty($this->context['group'])) {
foreach ($this->context['group'] as $context_id => $context_enabled) {
if ($context_enabled) {
$item = $this->config_pages_context
->createInstance($context_id);
if ($fallback && !empty($this->context['fallback'][$context_id])) {
$context_value = $this->context['fallback'][$context_id];
}
else {
$context_value = $item
->getValue();
}
$contextData[] = [
$context_id => $context_value,
];
}
}
}
return serialize($contextData);
}