public function renderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme in Cheeseburger Menu 8
Same name and namespace in other branches
- 8.4 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme()
- 8.2 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme()
- 8.3 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme()
File
- src/
Controller/ renderCheeseburgerMenuBlock.php, line 542
Class
Namespace
Drupal\cheeseburger_menu\ControllerCode
public function returnBreakpointsForDefaultTheme() {
/** @var \Drupal\Core\Extension\ThemeHandler $theme_handler */
$theme_handler = \Drupal::service('theme_handler');
/** @var \Drupal\breakpoint\BreakpointManager $breakpoint_manager */
$breakpoint_manager = \Drupal::service('breakpoint.manager');
$groups = $breakpoint_manager
->getGroups();
$list = [];
foreach ($groups as $group) {
//dsm($group);
if (is_object($group)) {
try {
$breakpoints = $breakpoint_manager
->getBreakpointsByGroup($group
->__toString());
foreach ($breakpoints as $key => $breakpoint) {
if ($breakpoint
->getProvider() == $theme_handler
->getDefault()) {
$list[$key]['mediaQuery'] = $breakpoint
->getMediaQuery();
$list[$key]['label'] = $breakpoint
->getLabel();
if (is_object($list[$key]['label'])) {
$list[$key]['label'] = $list[$key]['label']
->__toString();
}
}
}
} catch (Exception $exception) {
//do nothing
}
}
else {
try {
$breakpoints = $breakpoint_manager
->getBreakpointsByGroup($group);
foreach ($breakpoints as $key => $breakpoint) {
if ($breakpoint
->getProvider() == $theme_handler
->getDefault()) {
$list[$key]['mediaQuery'] = $breakpoint
->getMediaQuery();
$list[$key]['label'] = $breakpoint
->getLabel();
if (is_object($list[$key]['label'])) {
$list[$key]['label'] = $list[$key]['label']
->__toString();
}
}
}
} catch (Exception $exception) {
//do nothing
}
}
}
return $list;
}