You are here

public function RenderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme in Cheeseburger Menu 8.4

Same name and namespace in other branches
  1. 8 src/Controller/renderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\renderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme()
  2. 8.2 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme()
  3. 8.3 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::returnBreakpointsForDefaultTheme()

Returning breakpoint data for default theme.

File

src/Controller/RenderCheeseburgerMenuBlock.php, line 517
Controller used for rendering block.

Class

RenderCheeseburgerMenuBlock
Class RenderCheeseburgerMenuBlock.

Namespace

Drupal\cheeseburger_menu\Controller

Code

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)) {
      $group = $group
        ->getUntranslatedString();
    }
    $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();
        }
      }
    }
  }
  return $list;
}