Function __global->add_menu_item_simple

Definitions

sources/menus2.php

  • Add a menu item, without giving tedious/unnecessary detail.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$menu_id SHORT_TEXT No No required parameter N/A N/A The name of the menu to add the item to
$parent ?mixed No No required parameter N/A N/A The menu item ID of the parent branch of the menu item (AUTO_LINK) / the URL of the parent-item (SHORT_TEXT) (null: is on root)
$caption SHORT_TEXT No No required parameter N/A N/A The caption
$url SHORT_TEXT No No Blank (empty string) N/A N/A The URL (in entry point form)
$expanded BINARY No No 0 N/A N/A Whether it is an expanded branch
$check_permissions BINARY No No 0 N/A N/A Whether people who may not view the entry point do not see the link
$dereference_caption boolean No No True N/A N/A Whether the caption is a content language string ID
$caption_long SHORT_TEXT No No Blank (empty string) N/A N/A The tooltip (blank: none)
$new_window BINARY No No 0 N/A N/A Whether the link will open in a new window
$theme_image_code ID_TEXT No No Blank (empty string) N/A N/A The theme image code
$include_sitemap SHORT_INTEGER No No 0 N/A N/A An INCLUDE_SITEMAP_* constant
$order ?integer No No Null N/A N/A Order to use (null: automatic, after the ones that have it specified)

Returns

  • The ID of the newly added menu item
  • Type: AUTO_LINK
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Add a menu item, without giving tedious/unnecessary detail.
 *
 * @param  SHORT_TEXT $menu_id The name of the menu to add the item to
 * @param  ?mixed $parent The menu item ID of the parent branch of the menu item (AUTO_LINK) / the URL of the parent-item (SHORT_TEXT) (null: is on root)
 * @param  SHORT_TEXT $caption The caption
 * @param  SHORT_TEXT $url The URL (in entry point form)
 * @param  BINARY $expanded Whether it is an expanded branch
 * @param  BINARY $check_permissions Whether people who may not view the entry point do not see the link
 * @param  boolean $dereference_caption Whether the caption is a content language string ID
 * @param  SHORT_TEXT $caption_long The tooltip (blank: none)
 * @param  BINARY $new_window Whether the link will open in a new window
 * @param  ID_TEXT $theme_image_code The theme image code
 * @param  SHORT_INTEGER $include_sitemap An INCLUDE_SITEMAP_* constant
 * @param  ?integer $order Order to use (null: automatic, after the ones that have it specified)
 * @return AUTO_LINK The ID of the newly added menu item
 */

function add_menu_item_simple(string $menu_id, $parent, string $caption, string $url = '', int $expanded = 0, int $check_permissions = 0, bool $dereference_caption = true, string $caption_long = '', int $new_window = 0, string $theme_image_code = '', int $include_sitemap = 0, ?int $order = null) : int