public function BreakpointManager::getGroups in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/breakpoint/src/BreakpointManager.php \Drupal\breakpoint\BreakpointManager::getGroups()
Gets all the existing breakpoint groups.
Return value
array Array of breakpoint group labels. Keyed by group name.
Overrides BreakpointManagerInterface::getGroups
File
- core/
modules/ breakpoint/ src/ BreakpointManager.php, line 186 - Contains \Drupal\breakpoint\BreakpointManager.
Class
- BreakpointManager
- Defines a breakpoint plugin manager to deal with breakpoints.
Namespace
Drupal\breakpointCode
public function getGroups() {
// Use a double colon so as to not clash with the cache for each group.
if ($cache = $this->cacheBackend
->get($this->cacheKey . '::groups')) {
$groups = $cache->data;
}
else {
$groups = array();
foreach ($this
->getDefinitions() as $plugin_definition) {
if (!isset($groups[$plugin_definition['group']])) {
$groups[$plugin_definition['group']] = $plugin_definition['group'];
}
}
$this->cacheBackend
->set($this->cacheKey . '::groups', $groups, Cache::PERMANENT, array(
'breakpoints',
));
}
// Get the labels. This is not cacheable due to translation.
$group_labels = array();
foreach ($groups as $group) {
$group_labels[$group] = $this
->getGroupLabel($group);
}
asort($group_labels);
return $group_labels;
}