Generic Menu

$menuData
First set up $menuData, which is an array of menu data - each key is a section, subsection or item name.

Section

 * string $title: Section title.
 * bool $enabled: Should section be shown?
 * array $areas: Array of areas within this section.
 * array $permission: Permission required to access the whole section.

Areas

 * array $permission: Array of permissions to determine who can access this area.
 * string $label: Optional text string for link (Otherwise $txt[$index] will be used)
 * string $file: Name of source file required for this area.
 * string $function: Function to call when area is selected.
 * string $custom_url: URL to use for this menu item.
 * bool $enabled: Should this area even be accessible?
 * bool $hidden: Should this area be visible?
 * string $select: If set this item will not be displayed - instead the item indexed here shall be.
 * array $subsections: Array of subsections from this area.

Subsections

 * string 0: Text label for this subsection.
 * array 1: Array of permissions to check for this subsection.
 * bool 2: Is this the default subaction - if not set for any will default to first...
 * bool enabled: Bool to say whether this should be enabled or not.

$menuOptions
Next, build $menuOptions, which is an array of various options for the menu
 * string action: The "action" that this menu should be displayed for
 * string current_area: The current area
 * bool disable_url_session_check: Whether or not to disable showing the session ID in the URL. Default is false.
 * array extra_url_parameters: An array containing any additional parameters that should be added to the URL in the form of 'parameter' => 'value'
 * string layer_name: The name of the template layer to include for this menu
 * enumerated string: What type of menu this is. If not specified, defaults to dropdown unless the user has specified otherwise. Can be either "dropdown" or "sidebar"
 * string template_name: The name of the template file containing the function to load this menu

'TO BE CONTINUED...