public function BreakpointGroup::save

Overrides Drupal\Core\Entity\Entity::save().

Overrides Entity::save

File

drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php, line 104
Definition of Drupal\breakpoint\Plugin\Core\Entity\BreakpointGroup.

Class

BreakpointGroup
Defines the BreakpointGroup entity.

Namespace

Drupal\breakpoint\Plugin\Core\Entity

Code

public function save() {

  // Check if everything is valid.
  if (!$this
    ->isValid()) {
    throw new InvalidBreakpointException('Invalid data detected.');
  }
  if (empty($this->id)) {
    $this->id = $this->sourceType . '.' . $this->source . '.' . $this->name;
  }

  // Only save the keys, but return the full objects.
  $this->breakpoints = array_keys($this->breakpoints);
  parent::save();
  $this
    ->loadAllBreakpoints();
}