Adding views and submenu items

Most components have more than a list view and a form. We will start out by adding the categories view, which takes advantage of the com_categories component in the Joomla! core.

The categories view

In our helper file, we need to create links for the sidebar submenu which is used to navigate between the various views. In Joomla! 2.5, it was represented by tabs, but in Joomla! 3, we use the sidebar. Edit the file /administrator/components/com_folio/helpers/folio.php, and add the following function:

public static function addSubmenu($vName = 'folios') { JHtmlSidebar::addEntry( JText::_('COM_FOLIO_SUBMENU_FOLIOS'), 'index.php?option=com_folio&view=folios', $vName == 'folios' ); JHtmlSidebar::addEntry( JText::_('COM_FOLIO_SUBMENU_CATEGORIES'), ...

Get Learning Joomla! 3 Extension Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.