function page_manager_page_form_menu

Form to handle menu item controls.

2 string references to 'page_manager_page_form_menu'
page_manager_page_add_subtask in page_manager/plugins/tasks/page.admin.inc
Page callback to add a subtask.
page_manager_page_build_subtask in page_manager/plugins/tasks/page.inc
Build a subtask array for a given page.

File

page_manager/plugins/tasks/page.admin.inc, line 661

Code

function page_manager_page_form_menu($form, &$form_state) {
    ctools_include('dependent');
    $form['menu'] = array(
        '#prefix' => '<div class="clearfix">',
        '#suffix' => '</div>',
        '#tree' => TRUE,
    );
    $menu = $form_state['page']->subtask['subtask']->menu;
    if (empty($menu)) {
        $menu = array(
            'type' => 'none',
            'title' => '',
            'weight' => 0,
            'name' => 'navigation',
            'parent' => array(
                'type' => 'none',
                'title' => '',
                'weight' => 0,
                'name' => 'navigation',
            ),
        );
    }
    $form['menu']['type'] = array(
        '#title' => t('Type'),
        '#type' => 'radios',
        '#options' => array(
            'none' => t('No menu entry'),
            'normal' => t('Normal menu entry'),
            'tab' => t('Menu tab'),
            'default tab' => t('Default menu tab'),
            'action' => t('Local action'),
        ),
        '#default_value' => $menu['type'],
    );
    $form['menu']['title'] = array(
        '#title' => t('Title'),
        '#type' => 'textfield',
        '#default_value' => $menu['title'],
        '#description' => t('If set to normal or tab, enter the text to use for the menu item. Renaming the menu item using the Drupal menu system (admin/structure/menu) will override this, even if it is renamed again here.'),
        '#dependency' => array(
            'radio:menu[type]' => array(
                'normal',
                'tab',
                'default tab',
                'action',
            ),
        ),
    );
    list($major, $minor) = explode('.', VERSION, 2);
    // Only display the menu selector if menu module is enabled.
    if (module_exists('menu')) {
        $form['menu']['name'] = array(
            '#title' => t('Menu'),
            '#type' => 'select',
            '#options' => menu_get_menus(),
            '#default_value' => $menu['name'],
            '#description' => t('Insert item into an available menu.'),
            '#dependency' => array(
                'radio:menu[type]' => array(
                    'normal',
                ),
            ),
        );
    }
    else {
        $form['menu']['name'] = array(
            '#type' => 'value',
            '#value' => $menu['name'],
        );
        $form['menu']['markup'] = array(
            '#value' => t('Menu selection requires the activation of menu module.'),
        );
    }
    $form['menu']['weight'] = array(
        '#title' => t('Weight'),
        '#type' => 'textfield',
        '#default_value' => isset($menu['weight']) ? $menu['weight'] : 0,
        '#description' => t('The lower the weight the higher/further left it will appear.'),
        '#dependency' => array(
            'radio:menu[type]' => array(
                'normal',
                'tab',
                'default tab',
                'action',
            ),
        ),
    );
    $form['menu']['parent']['type'] = array(
        '#prefix' => '<div id="edit-menu-parent-type-wrapper">',
        '#suffix' => '</div>',
        '#title' => t('Parent menu item'),
        '#type' => 'radios',
        '#options' => array(
            'none' => t('No menu entry'),
            'normal' => t('Normal menu item'),
            'tab' => t('Menu tab'),
        ),
        '#default_value' => $menu['parent']['type'],
        '#description' => t('When providing a menu item as a default tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is <em>foo/bar/baz</em>, the parent path would be <em>foo/bar</em>.'),
        '#dependency' => array(
            'radio:menu[type]' => array(
                'default tab',
            ),
        ),
    );
    $form['menu']['parent']['title'] = array(
        '#title' => t('Parent item title'),
        '#type' => 'textfield',
        '#default_value' => $menu['parent']['title'],
        '#description' => t('If creating a parent menu item, enter the title of the item.'),
        '#dependency' => array(
            'radio:menu[type]' => array(
                'default tab',
            ),
            'radio:menu[parent][type]' => array(
                'normal',
                'tab',
            ),
        ),
        '#dependency_count' => 2,
    );
    // Only display the menu selector if menu module is enabled.
    if (module_exists('menu')) {
        $form['menu']['parent']['name'] = array(
            '#title' => t('Parent item menu'),
            '#type' => 'select',
            '#options' => menu_get_menus(),
            '#default_value' => $menu['parent']['name'],
            '#description' => t('Insert item into an available menu.'),
            '#dependency' => array(
                'radio:menu[type]' => array(
                    'default tab',
                ),
                'radio:menu[parent][type]' => array(
                    'normal',
                ),
            ),
            '#dependency_count' => 2,
        );
    }
    else {
        $form['menu']['parent']['name'] = array(
            '#type' => 'value',
            '#value' => $menu['parent']['name'],
        );
    }
    $form['menu']['parent']['weight'] = array(
        '#title' => t('Parent weight'),
        '#type' => 'textfield',
        '#default_value' => $menu['parent']['weight'],
        '#size' => 5,
        '#description' => t('Enter the weight of the parent item. The lower the number, the more to the left it will be.'),
        '#dependency' => array(
            'radio:menu[type]' => array(
                'default tab',
            ),
            'radio:menu[parent][type]' => array(
                'tab',
                'normal',
            ),
        ),
        '#dependency_count' => 2,
    );
    return $form;
}