function ShortcutSet::resetLinkWeights

Same name and namespace in other branches
  1. 11.x core/modules/shortcut/src/Entity/ShortcutSet.php \Drupal\shortcut\Entity\ShortcutSet::resetLinkWeights()

File

core/modules/shortcut/src/Entity/ShortcutSet.php, line 113

Class

ShortcutSet
Defines the Shortcut set configuration entity.

Namespace

Drupal\shortcut\Entity

Code

public function resetLinkWeights() {
  $weight = -50;
  foreach ($this->getShortcuts() as $shortcut) {
    $shortcut->setWeight(++$weight);
    $shortcut->save();
  }
  return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.