function menu_parent_options

cis7 menu.module menu_parent_options($menus, $item, $type = '')
cle7 menu.module menu_parent_options($menus, $item, $type = '')
elmsmedia7 menu.module menu_parent_options($menus, $item, $type = '')
icor7 menu.module menu_parent_options($menus, $item, $type = '')
meedjum_blog7 menu.module menu_parent_options($menus, $item, $type = '')
mooc7 menu.module menu_parent_options($menus, $item, $type = '')

Return a list of menu items that are valid possible parents for the given menu item.

@todo This has to be turned into a #process form element callback. The 'menu_override_parent_selector' variable is entirely superfluous.

Parameters

$menus: An array of menu names and titles, such as from menu_get_menus().

$item: The menu item or the node type for which to generate a list of parents. If $item['mlid'] == 0 then the complete tree is returned.

$type: The node type for which to generate a list of parents. If $item itself is a node type then $type is ignored.

Return value

An array of menu link titles keyed on the a string containing the menu name and mlid. The list excludes the given item and its children.

9 calls to menu_parent_options()
context_condition_menu::condition_values in sites/all/modules/ulmus/context/plugins/context_condition_menu.inc
Override of condition_values().
context_reaction_menu::options_form in sites/all/modules/ulmus/context/plugins/context_reaction_menu.inc
Provide a form element that allow the admin to chose a menu item.
menu_block_configure_form in sites/all/modules/local_contrib/menu_block/menu_block.admin.inc
Returns the configuration form for a menu tree.
menu_block_menu_tree_content_type_edit_form in sites/all/modules/local_contrib/menu_block/plugins/content_types/menu_tree/menu_tree.inc
'Edit form' callback for the content type.
menu_edit_item in modules/menu/menu.admin.inc
Menu callback; Build the menu link editing form.

... See full list

File

modules/menu/menu.module, line 353
Allows administrators to customize the site's navigation menus.

Code

function menu_parent_options($menus, $item, $type = '') {
  // The menu_links table can be practically any size and we need a way to
  // allow contrib modules to provide more scalable pattern choosers.
  // hook_form_alter is too late in itself because all the possible parents are
  // retrieved here, unless menu_override_parent_selector is set to TRUE.
  if (variable_get('menu_override_parent_selector', FALSE)) {
    return array();
  }

  $available_menus = array();
  if (!is_array($item)) {
    // If $item is not an array then it is a node type.
    // Use it as $type and prepare a dummy menu item for _menu_get_options().
    $type = $item;
    $item = array('mlid' => 0);
  }
  if (empty($type)) {
    // If no node type is set, use all menus given to this function.
    $available_menus = $menus;
  }
  else {
    // If a node type is set, use all available menus for this type.
    $type_menus = variable_get('menu_options_' . $type, array('main-menu' => 'main-menu'));
    foreach ($type_menus as $menu) {
      $available_menus[$menu] = $menu;
    }
  }

  return _menu_get_options($menus, $available_menus, $item);
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.