function BreakpointManager::getBreakpointsByGroup
Same name in other branches
- 9 core/modules/breakpoint/src/BreakpointManager.php \Drupal\breakpoint\BreakpointManager::getBreakpointsByGroup()
- 8.9.x core/modules/breakpoint/src/BreakpointManager.php \Drupal\breakpoint\BreakpointManager::getBreakpointsByGroup()
- 11.x core/modules/breakpoint/src/BreakpointManager.php \Drupal\breakpoint\BreakpointManager::getBreakpointsByGroup()
1 call to BreakpointManager::getBreakpointsByGroup()
- BreakpointManager::getGroupProviders in core/
modules/ breakpoint/ src/ BreakpointManager.php
File
-
core/
modules/ breakpoint/ src/ BreakpointManager.php, line 158
Class
- BreakpointManager
- Defines a breakpoint plugin manager to deal with breakpoints.
Namespace
Drupal\breakpointCode
public function getBreakpointsByGroup($group) {
if (!isset($this->breakpointsByGroup[$group])) {
if ($cache = $this->cacheBackend
->get($this->cacheKey . ':' . $group)) {
$this->breakpointsByGroup[$group] = $cache->data;
}
else {
$breakpoints = [];
foreach ($this->getDefinitions() as $plugin_id => $plugin_definition) {
if ($plugin_definition['group'] == $group) {
$breakpoints[$plugin_id] = $plugin_definition;
}
}
uasort($breakpoints, [
'Drupal\\Component\\Utility\\SortArray',
'sortByWeightElement',
]);
$this->cacheBackend
->set($this->cacheKey . ':' . $group, $breakpoints, Cache::PERMANENT, [
'breakpoints',
]);
$this->breakpointsByGroup[$group] = $breakpoints;
}
}
$instances = [];
foreach ($this->breakpointsByGroup[$group] as $plugin_id => $definition) {
if (!isset($this->instances[$plugin_id])) {
$this->instances[$plugin_id] = $this->createInstance($plugin_id);
}
$instances[$plugin_id] = $this->instances[$plugin_id];
}
return $instances;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.