Function __global->build_menu

Definitions

sources/menus.php

  • Take a menu identifier, and return a menu created from it.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$type ID_TEXT No No required parameter N/A N/A The type of the menu (determines which templates to use)
$menu_id SHORT_TEXT No No required parameter N/A N/A The menu identifier to use (may be the name of a editable menu, or syntax to load from the Sitemap)
$silent_failure boolean No No False N/A N/A Whether to silently return blank if the menu does not exist
$apply_highlighting boolean No No True N/A N/A Whether to apply current-screen highlighting
$tray_status string No No tray_closed tray_open tray_closed N/A The default expansion status of the node

Returns

  • A tuple: The generated Tempcode of the menu, the menu nodes, whether we flattened
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Take a menu identifier, and return a menu created from it.
 *
 * @param  ID_TEXT $type The type of the menu (determines which templates to use)
 * @param  SHORT_TEXT $menu_id The menu identifier to use (may be the name of a editable menu, or syntax to load from the Sitemap)
 * @param  boolean $silent_failure Whether to silently return blank if the menu does not exist
 * @param  boolean $apply_highlighting Whether to apply current-screen highlighting
 * @param  string $tray_status The default expansion status of the node
 * @set tray_open tray_closed
 * @return array A tuple: The generated Tempcode of the menu, the menu nodes, whether we flattened
 */

function build_menu(string $type, string $menu_id, bool $silent_failure = false, bool $apply_highlighting = true, string $tray_status = 'tray_closed') : array