Overrides Drupal\config\ConfigEntityBase::save().
Overrides Entity::save
public function save() {
// Check if everything is valid.
if (!$this
->isValid()) {
throw new InvalidBreakpointException('Invalid data detected.');
}
// Build an id if none is set.
// Since a particular name can be used by multiple theme/modules we need
// to make a unique id.
if (empty($this->id)) {
$this->id = $this->sourceType . '.' . $this->source . '.' . $this->name;
}
// Set the label if none is set.
if (empty($this->label)) {
$this->label = $this->name;
}
// Remove unused multipliers.
$this->multipliers = array_filter($this->multipliers);
// Always add '1x' multiplier, use array_key_exists since the value might
// be NULL.
if (!array_key_exists('1x', $this->multipliers)) {
$this->multipliers = array(
'1x' => '1x',
) + $this->multipliers;
}
return parent::save();
}