public function ConfigPagesType::getContextLabel in Config Pages 8.3
Same name and namespace in other branches
- 8 src/Entity/ConfigPagesType.php \Drupal\config_pages\Entity\ConfigPagesType::getContextLabel()
- 8.2 src/Entity/ConfigPagesType.php \Drupal\config_pages\Entity\ConfigPagesType::getContextLabel()
Provides the context labels.
Return value
string Return context label.
Throws
\Drupal\Component\Plugin\Exception\PluginException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
File
- src/
Entity/ ConfigPagesType.php, line 126
Class
- ConfigPagesType
- Defines the config page type entity.
Namespace
Drupal\config_pages\EntityCode
public function getContextLabel() {
$contextData = [];
if (!empty($this->context['group'])) {
foreach ($this->context['group'] as $context_id => $context_enabled) {
if ($context_enabled) {
$item = $this->config_pages_context
->getDefinition($context_id);
$context = $this->config_pages_context
->createInstance($context_id);
$context_value = $item['label'] . ' (' . $context
->getLabel() . ')';
$contextData[] = $context_value;
}
}
}
return implode(', ', $contextData);
}