Menu Class
This class takes an array of elements that you can create a parent child relationship by creating an array like so:.
$nav['about/history'] = array('label' => 'About', 'parent_id' => 'about'); OR $nav['about/history'] = array('location' => 'about_us/history', label' => 'About', 'parent_id' => 'about'); The documentation gives more detail.
Properties Reference
Property | Default Value | Description |
---|---|---|
public | ||
active_class | active | The active css class |
active | none | The active menu item |
styles |
array() |
Css class styles to apply to menu items... can be a nested array |
first_class | first | The css class for the first menu item |
last_class | last | The css class for the last menu item |
depth | none | The depth of the menu to render at |
use_titles | none | Use the title attribute in the links |
root_value | none | The root parent value... can be NULL or 0 |
container_tag | ul | The html tag for the container of a set of menu items |
container_tag_attrs | none | Html attributes for the container tag |
container_tag_id | none | Html container id |
container_tag_class | none | Html container class |
subcontainer_tag_class |
array() |
An array of css classes to apply to subcontainers |
cascade_selected | 1 | Cascade the selected items |
include_hidden | none | Include menu items with the hidden attribute |
item_tag | li | The html list item element |
item_id_prefix | none | The prefix to the item id |
item_id_key | id | Either id or location |
use_nav_key | AUTO | Use the nav_key value to match active |
render_type | basic | Basic, breadcrumb, page_title, collapsible, delimited, array |
pre_render_func | none | Function to apply to menu labels before rendering |
delimiter | none | The html element between the links |
display_current | 1 | Display the current active breadcrumb item? |
home_link | Home | The root home link |
arrow_class | arrow | The class for the arrows |
order | asc | The order to display... for page_title ONLY |
protected | ||
_items | N/A | The items in the menu |
_active_items | N/A | The active menu items |
_reset_params | N/A | Reset params |
Function Reference [+]
$this->menu->initialize([$params=array()])
Initialize preferences.
Returns
void
Parameters
(array) $params
$this->menu->set_params($params)
Set object parameters.
Returns
void
Parameters
(array) $params
$this->menu->clear()
Same as reset.
Returns
void
$this->menu->reset()
Clear class values.
Returns
void
$this->menu->normalize_items($items)
Normalizes the menu data.
Returns
array
Parameters
(array) $items menu item data
$this->menu->render($items, ['$active'=NULL], ['$parent_id'=NULL], ['$render_type'=NULL])
Renders the menu output.
Returns
string
Parameters
(array) $items menu item data (string) $active the active menu item (mixed) $parent_id int or string of the parent id to begin rendering the menu items (string) $render_type basic, breadcrumb, page_title, collapsible
$this->menu->render_collapsible($items, ['$active'=NULL], ['$parent_id'=NULL])
Renders collapsible menu menu output.
Returns
string
Parameters
(array) $items menu item data (string) $active the active menu item (mixed) $parent_id int or string of the parent id to begin rendering the menu items
$this->menu->render_breadcrumb($items, ['$active'=NULL], ['$parent_id'=NULL])
Renders breadcrumb menu output.
Returns
string
Parameters
(array) $items menu item data (string) $active the active menu item (mixed) $parent_id int or string of the parent id to begin rendering the menu items
$this->menu->render_page_title($items, ['$active'=NULL], ['$parent_id'=NULL])
Renders page_title menu output.
Returns
string
Parameters
(array) $items menu item data (string) $active the active menu item (mixed) $parent_id int or string of the parent id to begin rendering the menu items
$this->menu->render_delimited($items, ['$active'=NULL], ['$parent_id'=NULL])
Renders page_title menu output.
Returns
string
Parameters
(array) $items menu item data (string) $active the active menu item (mixed) $parent_id int or string of the parent id to begin rendering the menu items
$this->menu->render_array($items, ['$active'=NULL], ['$parent_id'=NULL])
Renders page_title menu output.
Returns
string
Parameters
(array) $items menu item data (string) $active the active menu item (mixed) $parent_id int or string of the parent id to begin rendering the menu items
$this->menu->active_items()
Returns the active items in the navigation. A render must be performed first.
Returns
array
$this->menu->get_items_in_path('$active', ['$first_time'=TRUE])
Gets the items in the active menu path.
Returns
string
Parameters
(string) $active active element (boolean) $first_time first time iterating through?