You are here

public function BreakpointGroup::override in Breakpoints 8

Override a breakpoint group.

Return value

Drupal\breakpoint\BreakpointGroup

File

lib/Drupal/breakpoint/BreakpointGroup.php, line 130
Definition of Drupal\breakpoint\BreakpointGroup.

Class

BreakpointGroup
Defines the BreakpointGroup entity.

Namespace

Drupal\breakpoint

Code

public function override() {

  // Custom breakpoint group can't be overridden.
  if ($this->overridden || $this->sourceType === Breakpoint::SOURCE_TYPE_CUSTOM) {
    return FALSE;
  }

  // Mark all breakpoints as overridden.
  foreach ($this->breakpoints as $key => $breakpoint) {
    if ($breakpoint->sourceType === $this->sourceType && $breakpoint->source == $this
      ->id()) {
      $breakpoint
        ->override();
    }
  }

  // Mark breakpoint group as overridden.
  $this->overridden = TRUE;
  $this
    ->save();
  return $this;
}