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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.