function SetCustomize::save
Same name in other branches
- 9 core/modules/shortcut/src/Form/SetCustomize.php \Drupal\shortcut\Form\SetCustomize::save()
- 10 core/modules/shortcut/src/Form/SetCustomize.php \Drupal\shortcut\Form\SetCustomize::save()
- 11.x core/modules/shortcut/src/Form/SetCustomize.php \Drupal\shortcut\Form\SetCustomize::save()
Overrides EntityForm::save
File
-
core/
modules/ shortcut/ src/ Form/ SetCustomize.php, line 104
Class
- SetCustomize
- Builds the shortcut set customize form.
Namespace
Drupal\shortcut\FormCode
public function save(array $form, FormStateInterface $form_state) {
foreach ($this->entity
->getShortcuts() as $shortcut) {
$weight = $form_state->getValue([
'shortcuts',
'links',
$shortcut->id(),
'weight',
]);
$shortcut->setWeight($weight);
$shortcut->save();
}
$this->messenger()
->addStatus($this->t('The shortcut set has been updated.'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.