Function __global->add_menu_item
Definitions
sources/menus2.php
- Add a menu item.
- 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 |
$order | integer | No | No | required parameter | N/A | N/A | The relative order of this item on the menu |
$parent | ?AUTO_LINK | No | No | required parameter | N/A | N/A | The menu item ID of the parent branch of the menu item (null: is on root) |
$caption | SHORT_TEXT | No | No | required parameter | N/A | N/A | The caption |
$url | SHORT_TEXT | No | No | required parameter | N/A | N/A | The URL (in entry point form) |
$check_permissions | BINARY | No | No | required parameter | N/A | N/A | Whether people who may not view the entry point do not see the link |
$page_only | SHORT_TEXT | No | No | required parameter | N/A | N/A | Match-keys to identify what pages the item is shown on |
$expanded | BINARY | No | No | required parameter | N/A | N/A | Whether it is an expanded branch |
$new_window | BINARY | No | No | required parameter | N/A | N/A | Whether the link will open in a new window |
$caption_long | SHORT_TEXT | No | No | required parameter | N/A | N/A | The tooltip (blank: none) |
$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 |
$id | ?AUTO_LINK | No | No | Null | N/A | N/A | The ID (null: auto-increment) |
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.
*
* @param SHORT_TEXT $menu_id The name of the menu to add the item to
* @param integer $order The relative order of this item on the menu
* @param ?AUTO_LINK $parent The menu item ID of the parent branch of the menu item (null: is on root)
* @param SHORT_TEXT $caption The caption
* @param SHORT_TEXT $url The URL (in entry point form)
* @param BINARY $check_permissions Whether people who may not view the entry point do not see the link
* @param SHORT_TEXT $page_only Match-keys to identify what pages the item is shown on
* @param BINARY $expanded Whether it is an expanded branch
* @param BINARY $new_window Whether the link will open in a new window
* @param SHORT_TEXT $caption_long The tooltip (blank: none)
* @param ID_TEXT $theme_image_code The theme image code
* @param SHORT_INTEGER $include_sitemap An INCLUDE_SITEMAP_* constant
* @param ?AUTO_LINK $id The ID (null: auto-increment)
* @return AUTO_LINK The ID of the newly added menu item
*/
function add_menu_item(string $menu_id, int $order, ?int $parent, string $caption, string $url, int $check_permissions, string $page_only, int $expanded, int $new_window, string $caption_long, string $theme_image_code = '', int $include_sitemap = 0, ?int $id = null) : int
* Add a menu item.
*
* @param SHORT_TEXT $menu_id The name of the menu to add the item to
* @param integer $order The relative order of this item on the menu
* @param ?AUTO_LINK $parent The menu item ID of the parent branch of the menu item (null: is on root)
* @param SHORT_TEXT $caption The caption
* @param SHORT_TEXT $url The URL (in entry point form)
* @param BINARY $check_permissions Whether people who may not view the entry point do not see the link
* @param SHORT_TEXT $page_only Match-keys to identify what pages the item is shown on
* @param BINARY $expanded Whether it is an expanded branch
* @param BINARY $new_window Whether the link will open in a new window
* @param SHORT_TEXT $caption_long The tooltip (blank: none)
* @param ID_TEXT $theme_image_code The theme image code
* @param SHORT_INTEGER $include_sitemap An INCLUDE_SITEMAP_* constant
* @param ?AUTO_LINK $id The ID (null: auto-increment)
* @return AUTO_LINK The ID of the newly added menu item
*/
function add_menu_item(string $menu_id, int $order, ?int $parent, string $caption, string $url, int $check_permissions, string $page_only, int $expanded, int $new_window, string $caption_long, string $theme_image_code = '', int $include_sitemap = 0, ?int $id = null) : int