You are here

function menu_block_menu_tree_content_type_edit_form in Menu Block 6.2

Same name and namespace in other branches
  1. 7.3 plugins/content_types/menu_tree/menu_tree.inc \menu_block_menu_tree_content_type_edit_form()
  2. 7.2 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 99
Provides ctools integration for "Menu block" trees.

Code

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

  // Load the standard config form.
  module_load_include('inc', 'menu_block', 'menu_block.admin');

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

  // 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';
    $form['admin_title']['#suffix'] = '<div id="edit-parent-wrapper"><strong>' . t('Parent item:') . '</strong><br />' . t('<em>The menu selected by the page</em> can be customized on the <a href="!url">Menu block settings page</a>.', array(
      '!url' => url('admin/settings/menu_block'),
    )) . '</div>';
  }

  // Add classes for jQuery script.
  $form['menu-block-wrapper-start']['#value'] = '<div id="menu-block-settings" class="menu-block-menu-tree-configure-form">';
  if (empty($form['override_title']['#attributes']['class'])) {
    $form['override_title']['#attributes']['class'] = 'menu-block-override-title';
  }
  else {
    $form['override_title']['#attributes']['class'] .= ' menu-block-override-title';
  }
}