function _menu_attributes_form_submit in Menu Attributes 8
Same name and namespace in other branches
- 6.2 menu_attributes.module \_menu_attributes_form_submit()
- 6 menu_attributes.module \_menu_attributes_form_submit()
- 7 menu_attributes.module \_menu_attributes_form_submit()
Form submit handler for menu item links.
Move the title attributes value into the 'description' value so that it will get properly saved.
1 string reference to '_menu_attributes_form_submit'
- _menu_attributes_form_alter in ./
menu_attributes.module - Add the menu attributes to a menu item edit form.
File
- ./
menu_attributes.module, line 251 - Alters the menu item form to allow the administrator to specify additional attributes for the menu link
Code
function _menu_attributes_form_submit($form, FormStateInterface $form_state) {
$menu_link = $form_state
->getFormObject()
->getEntity();
$options = [
MENU_ATTRIBUTES_LINK => $form_state
->getValue(MENU_ATTRIBUTES_LINK),
MENU_ATTRIBUTES_ITEM => $form_state
->getValue(MENU_ATTRIBUTES_ITEM),
];
$menu_link->link
->first()->options = $options;
$menu_link
->save();
}