Function __global->create_menu_structure

Definitions

sources/menus2.php

  • Create a menu structure programmatically.This function is intended for programmers, writing upgrade scripts for a custom site (dev>staging>live).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$structure array No No required parameter N/A N/A Menu structure (see function code for an example)
$menu_name ID_TEXT No No main_menu N/A N/A Menu name to use
$reset boolean No No True N/A N/A Whether to delete the current menu contents
$parent ?AUTO_LINK No No Null N/A N/A Parent of current node in recursion (null: no parent)

Preview

Code (PHP)

/**
 * Create a menu structure programmatically.This function is intended for programmers, writing upgrade scripts for a custom site (dev>staging>live).
 *
 * @param  array $structure Menu structure (see function code for an example)
 * @param  ID_TEXT $menu_name Menu name to use
 * @param  boolean $reset Whether to delete the current menu contents
 * @param  ?AUTO_LINK $parent Parent of current node in recursion (null: no parent)
 */

function create_menu_structure(array $structure, string $menu_name = 'main_menu', bool $reset = true, ?int $parent = null)