You are here

function multiple_node_menu_node_submit in Multiple Node Menu 7

Implements hook_node_submit().

See also

multiple_node_menu_form_node_form_alter()

File

./multiple_node_menu.module, line 284
Add multiple menu management capabilities to node form.

Code

function multiple_node_menu_node_submit($node, $form, &$form_state) {
  if (!variable_get('menu_options_' . $node->type, FALSE)) {
    return;
  }

  // Include 'Add new menu link' form values if it was set.
  _multiple_node_menu_add_link($form_state);
  $values = $form_state['values']['multiple_node_menu'];
  if (!empty($values['current_links'])) {
    foreach ($values['current_links'] as $delta => $link) {
      if (!empty($link['parent'])) {

        // Decompose the selected menu parent option into 'menu_name' and 'plid',
        // if the form used the default parent selection widget.
        list($link['menu_name'], $link['plid']) = explode(':', $link['parent']);
      }

      // If 'Provide menu link' checkbox is unchecked. Mark all items disabled.
      if (empty($values['enabled'])) {
        $link['enabled'] = FALSE;
      }

      // Update all links to node object.
      $node->multiple_node_menu_links[$delta] = $link;
    }
  }
}