You are here

function menu_block_menu_tree_content_type_edit_form in Menu Block 7.2

Same name and namespace in other branches
  1. 6.2 plugins/content_types/menu_tree/menu_tree.inc \menu_block_menu_tree_content_type_edit_form()
  2. 7.3 plugins/content_types/menu_tree/menu_tree.inc \menu_block_menu_tree_content_type_edit_form()

'Edit form' callback for the content type.

File

plugins/content_types/menu_tree/menu_tree.inc, line 106
Provides ctools integration for "Menu block" trees.

Code

function menu_block_menu_tree_content_type_edit_form($form, &$form_state) {
  $conf = $form_state['conf'];

  // Create a pseudo form state.
  $sub_form_state = array(
    'values' => $conf,
  );
  $form += menu_block_configure_form($form, $sub_form_state);

  // Hide the menu selector.
  $form['menu_name']['#type'] = 'hidden';

  // Set the options to a simple list of menu links for the configured menu.
  $menus = menu_block_get_all_menus();
  $form['parent']['#options'] = menu_parent_options(array(
    $conf['menu_name'] => $menus[$conf['menu_name']],
  ), array(
    'mlid' => 0,
  ));

  // Hide the Parent item option for the special "active" menu.
  if ($conf['menu_name'] == MENU_TREE__CURRENT_PAGE_MENU) {
    $form['parent']['#type'] = 'hidden';
  }

  // Remove CSS class hooks for jQuery script on parent select.
  unset($form['parent']['#attributes']);
  return $form;
}