Using Joomla! categories in our component
In Chapter 1, Planning Your Component, when we defined the database for our extension, we added an integer column called category
to the Projects table. We did not create a database table to store our categories, because we want to integrate it with Joomla! categories.
We will now integrate our categories using the power of the Joomla! FrameworkTM.
First, we edit the src/component/admin/forms/project.xml
file to add the following field:
<field name="category" type="category" extension="com_spm" default="" label="COM_SPM_PROJECT_FORM_CATEGORY_LABEL" description="COM_SPM_PROJECT_FORM_CATEGORY_DESCRIPTION" required="true" > <option value="...