You are here

function menu_firstchild_menu_link_content_form_submit in Menu Firstchild 8

Form submit callback.

1 string reference to 'menu_firstchild_menu_link_content_form_submit'
menu_firstchild_form_menu_link_content_form_alter in ./menu_firstchild.module
Implements hook_form_BASE_FORM_ID_alter().

File

./menu_firstchild.module, line 88
Contains menu_firstchild.module.

Code

function menu_firstchild_menu_link_content_form_submit($form, FormStateInterface $form_state) {
  $value = [
    'menu_firstchild' => [
      'enabled' => $form_state
        ->getValue('menu_firstchild_enabled'),
    ],
  ];
  $link = $form_state
    ->getFormObject()
    ->getEntity();
  $options = $link->link
    ->first()->options;
  $link->link
    ->first()->options = array_merge($options, $value);
  $link
    ->save();
}