function responsive_menu_menu_link_content_submit in Responsive and off-canvas menu 4.3.x
Same name and namespace in other branches
- 8.3 responsive_menu.module \responsive_menu_menu_link_content_submit()
- 8.2 responsive_menu.module \responsive_menu_menu_link_content_submit()
- 4.4.x responsive_menu.module \responsive_menu_menu_link_content_submit()
- 4.0.x responsive_menu.module \responsive_menu_menu_link_content_submit()
- 4.1.x responsive_menu.module \responsive_menu_menu_link_content_submit()
Submit handler which stores any flyleft settings.
1 string reference to 'responsive_menu_menu_link_content_submit'
- responsive_menu_form_menu_link_content_form_alter in ./
responsive_menu.module - Implements hook_form_FORM_ID_alter() for menu_link_content_form().
File
- ./
responsive_menu.module, line 305 - Contains procedural code.
Code
function responsive_menu_menu_link_content_submit($form, FormStateInterface $form_state) {
// Store the flyleft as an option on the menu link entity.
if ($form_state
->getValue('flyleft')) {
$menu_link = $form_state
->getFormObject()
->getEntity();
$options = [
'attributes' => [
'flyleft' => TRUE,
],
];
$menu_link_options = $menu_link->link
->first()->options;
$menu_link->link
->first()->options = array_merge($menu_link_options, $options);
$menu_link
->save();
}
}