public function RenderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme in Cheeseburger Menu 8.3
Same name and namespace in other branches
- 8.4 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme()
- 8 src/Controller/renderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\renderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme()
- 8.2 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme()
Returning breakpoint data for default theme.
File
- src/
Controller/ RenderCheeseburgerMenuBlock.php, line 734 - Controller used for rendering block.
Class
- RenderCheeseburgerMenuBlock
- Class RenderCheeseburgerMenuBlock.
Namespace
Drupal\cheeseburger_menu\ControllerCode
public function returnBreakpointsForDefaultTheme() {
/** @var \Drupal\Core\Extension\ThemeHandler $theme_handler */
$theme_handler = $this->themeHandler;
/** @var \Drupal\breakpoint\BreakpointManager $breakpoint_manager */
$breakpoint_manager = $this->breakPointManager;
$groups = $breakpoint_manager
->getGroups();
$list = [];
foreach ($groups as $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;
}