You are here

function hs_menu_form_alter in Hierarchical Select 6.3

Same name and namespace in other branches
  1. 5.3 modules/hs_menu.module \hs_menu_form_alter()

Implementation of hook_form_alter().

File

modules/hs_menu.module, line 30
Implementation of the Hierarchical Select API for the Menu module.

Code

function hs_menu_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['type']['#value']) && $form['type']['#value'] . '_node_form' == $form_id && isset($form['menu']['parent']) && $form['menu']['#access']) {
    unset($form['menu']['parent']['#options']);
    $form['menu']['parent']['#type'] = 'hierarchical_select';
    _hs_menu_apply_config($form['menu']['parent'], NULL);
  }
  if ($form_id == 'menu_edit_item') {
    unset($form['menu']['parent']['#options']);
    $form['menu']['parent']['#type'] = 'hierarchical_select';
    _hs_menu_apply_config($form['menu']['parent'], array(
      $form['menu']['#item']['menu_name'],
      $form['menu']['#item']['mlid'],
    ));
  }
}