getNavItem Application Delegate Class Method[Permalink]Return to Application Delegate Class
SynopsisThe getNavItem() method of the application delegate class can be used to override the items that appear in the navigation menu (i.e. the menu that allows users to select the table via either tabs along the top or items along the side). It should return an associative array with characteristics of the navigation item including the href (i.e. link), label, and selected status. Using this method it is now possible to have non-table navigation items as well. You would just add these items to the \[_tables\] section of the conf.ini file then override the item using this method. Since 1.3 How the Nav Menu Is BuiltXataface builds the navigation menu by looping through each item in the [_tables] section of the conf.ini file, passing it to the getNavItem() method, and adding the resulting navigation item to the menu. If getNavItem() returns null, then that item will be skipped. If getNavItem throws an exception, then the default rendering for the menu item will take place. Signature
Parameters
ReturnsThis method should return either:
If returning an associative array, it should contain the following keys:
ThrowsIf you want to signal Xataface to just use default rendering for the current navigation item you can just throw an exception. The default rendering will link to the table named $key, and the item's label will be the same as $label. ExamplesGiven the following conf.ini file:
Suppose we want the navigation menu to only show the people and books options for regular users. Admin users can see all options. In addition, the 'reports' option doesn't correspond with a table of the database. Instead we are just going to link it to a custom action named 'reports'. Our getNavItem() method will look something like this:
See Also
|