CMS  Version 3.9
Menu Class Reference

Inherits DataItem.

Public Member Functions

 Site ()
 
 MenuItems ($constraint="")
 
 getMenuItem ($title)
 Finds the specified MenuItem within the menu, by title. More...
 
 menuItemExists ($title)
 Checks whether the specified menu item exists within the menu. More...
 

Static Public Member Functions

static findByIdentifier ($identifier)
 Returns the Menu object that matches the specified identifier. More...
 

Public Attributes

 $primary_key = "menu_id"
 
 $table = "menu"
 
 $default_format = "{name}"
 
 $pretty_class_name = "Menu"
 
 $fields
 
 $relations
 

Detailed Description

Definition at line 40 of file menus.inc.

Member Function Documentation

◆ findByIdentifier()

static Menu::findByIdentifier (   $identifier)
static

Returns the Menu object that matches the specified identifier.

Parameters
string$identifierthe identifier of the menu
Returns
Menu the matching menu item
Exceptions
DataNotFoundException

Definition at line 80 of file menus.inc.

81  {
82  return Query::create(Menu, "WHERE identifier=:i")
83  ->bind(":i", $identifier)
84  ->executeSingle();
85  }
Definition: menus.inc:41
$identifier
Definition: rss.inc:37

◆ getMenuItem()

Menu::getMenuItem (   $title)

Finds the specified MenuItem within the menu, by title.

Parameters
string$titlethe title of the menu item
Returns
MenuItem the matching menu item

Definition at line 92 of file menus.inc.

93  {
94  return Query::create(MenuItem, "WHERE menu_id=:m AND title=:t")
95  ->bind(":m", $this->menu_id, ":t", $title)
96  ->executeSingle();
97  }
$menuItem menu_id
$title
Definition: menus.inc:44

◆ menuItemExists()

Menu::menuItemExists (   $title)

Checks whether the specified menu item exists within the menu.

Parameters
string$titlethe title of the menu item
Returns
boolean true if a matching menu item exists, false otherwise

Definition at line 104 of file menus.inc.

105  {
106  return Query::create(MenuItem, "WHERE menu_id=:m AND title=:t")
107  ->bind(":m", $this->menu_id, ":t", $title)
108  ->exists();
109  }

◆ MenuItems()

Menu::MenuItems (   $constraint = "")

Definition at line 69 of file menus.inc.

70  {
71  return $this->getRelatedList(MenuItem, "", $constraint);
72  }
$constraint

◆ Site()

Menu::Site ( )

Definition at line 64 of file menus.inc.

65  {
66  return $this->getRelated(Site);
67  }
Definition: site.inc:40

Member Data Documentation

◆ $default_format

Menu::$default_format = "{name}"

Definition at line 45 of file menus.inc.

◆ $fields

Menu::$fields
Initial value:
= array("menu_id" => Number,
"site_id" => Number,
"name" => String,
"identifier" => String,
"description" => Text,
"css_class" => String,
"container_css_class" => String,
"wrap_menu_items" => Boolean,
"highlight_current_item" => Boolean,
"highlight_current_section" => Boolean)

Definition at line 49 of file menus.inc.

◆ $pretty_class_name

Menu::$pretty_class_name = "Menu"

Definition at line 46 of file menus.inc.

◆ $primary_key

Menu::$primary_key = "menu_id"

Definition at line 42 of file menus.inc.

◆ $relations

Menu::$relations
Initial value:
= array( "Site" => Site,
"MenuItems" => MenuItem)

Definition at line 61 of file menus.inc.

◆ $table

Menu::$table = "menu"

Definition at line 43 of file menus.inc.


The documentation for this class was generated from the following file: