You are here

function navbar_update_7000 in Navbar 7

Update the breakpoints.

narrow: 'only screen and (min-width: 16.5em)' standard: 'only screen and (min-width: 38.125em)' wide: 'only screen and (min-width: 52em)'

The D8 Toolbar changes introduced two new breakpoints. We need to update the existing Navbar installs with these two new breakpoints.

File

./navbar.install, line 55
navbar.install

Code

function navbar_update_7000() {

  // Increase the weight of the wide breakpoint.
  $wide = breakpoints_breakpoint_load('wide', 'navbar', 'module');
  $wide->weight = 2;
  breakpoints_breakpoint_save($wide);

  // Add a breakpoint for narrow screens.
  $narrow = breakpoints_breakpoint_load('narrow', 'navbar', 'module');
  if (empty($narrow)) {
    $breakpoint = new stdClass();
    $breakpoint->disabled = FALSE;
    $breakpoint->api_version = 1;
    $breakpoint->name = 'narrow';
    $breakpoint->breakpoint = 'only screen and (min-width: 16.5em)';
    $breakpoint->source = 'navbar';
    $breakpoint->source_type = 'module';
    $breakpoint->status = 1;
    $breakpoint->weight = 0;
    $breakpoint->multipliers = array();
    breakpoints_breakpoint_save($breakpoint);
  }
  $standard = breakpoints_breakpoint_load('standard', 'navbar', 'module');
  if (empty($standard)) {

    // Add a breakpoint for standard screens.
    $breakpoint = new stdClass();
    $breakpoint->disabled = FALSE;
    $breakpoint->api_version = 1;
    $breakpoint->name = 'standard';
    $breakpoint->breakpoint = 'only screen and (min-width: 38.125em)';
    $breakpoint->source = 'navbar';
    $breakpoint->source_type = 'module';
    $breakpoint->status = 1;
    $breakpoint->weight = 1;
    $breakpoint->multipliers = array();
    breakpoints_breakpoint_save($breakpoint);
  }
}