Gets style groups.
array Collection of style groups.
Overrides StyleDiscoveryInterface::getStyleGroups
public function getStyleGroups() {
$cache_id = 'paragraphs_collection_style_group';
if ($this->groupCollection !== NULL) {
return $this->groupCollection;
}
else {
if ($cached = $this->cache
->get($cache_id)) {
$this->groupCollection = $cached->data;
}
else {
$yaml_discovery = $this
->getYamlGroupDiscovery();
$this->groupCollection = [];
foreach ($yaml_discovery
->findAll() as $module => $groups) {
foreach ($groups as $group => $definition) {
if (empty($definition['label'])) {
throw new InvalidStyleException('The "label" of "' . $group . '" must be non-empty.');
}
$this->groupCollection[$group] = [
'label' => $this
->t($definition['label']),
'widget_label' => isset($definition['widget_label']) ? $this
->t($definition['widget_label']) : NULL,
];
}
}
$this->cache
->set($cache_id, $this->groupCollection);
}
}
return $this->groupCollection;
}