Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

012. Adding categories

Astrid edited this page Nov 9, 2019 · 6 revisions

Adding categories

In this chapter we will ...

Now, we want to add a categorie.

t12_1

t12_2

t12_3

Newly created or Modified files

Newly created files

administrator/components/com_foos/sql/updates/mysql/1.12.0.sql

Modified files

changelog.xml

foo_update.xml

administrator/components/com_foos/Extension/FoosComponent.php

administrator/components/com_foos/Model/FoosModel.php

administrator/components/com_foos/access.xml

administrator/components/com_foos/foos.xml

administrator/components/com_foos/forms/foo.xml

administrator/components/com_foos/services/provider.php

administrator/components/com_foos/tmpl/foo/edit.php

administrator/components/com_foos/tmpl/foos/default.php

All changes at a glance

Click here to see all changes compared to the last chapter

More detailed explanations

File Structure

Example in Joomla 4

Side Note

Test your component

Now you can zip all files and install them via Joomla Extension Manager. After that you can see a link to your component in the left side menu. Clicking on this link will open the basic backend view.

Concluding Remark

Now we have . Up to now we have no . We are going to work on this in the next chapter.

Overview of all files

Requirements

You need Joomla! 4.x for this tutorial (as of writing currently Joomla! 4.0.0-alpha11-dev)

File Structure

Changing administrator/components/com_foos/Model/FoosModel.php

The administrator/components/com_foos/Model/FoosModel.php file is ....

Completed administrator/components/com_foos/Model/FoosModel.php file

The code for the administrator/components/com_foos/Model/FoosModel.php file is as follows:

Changing administrator/components/com_foos/access.xml

The administrator/components/com_foos/access.xml file is ....

Completed administrator/components/com_foos/access.xml file

The code for the administrator/components/com_foos/access.xml file is as follows:

Changing administrator/components/com_foos/foos.xml

The administrator/components/com_foos/foos.xml file is ....

Completed administrator/components/com_foos/foos.xml file

The code for the administrator/components/com_foos/foos.xml file is as follows:

Changing administrator/components/com_foos/forms/foo.xml

The administrator/components/com_foos/forms/foo.xml file is ....

Completed administrator/components/com_foos/forms/foo.xml file

The code for the administrator/components/com_foos/forms/foo.xml file is as follows:

Changing administrator/components/com_foos/tmpl/foo/edit.php

The administrator/components/com_foos/tmpl/foo/edit.php file is ....

Completed administrator/components/com_foos/tmpl/foo/edit.php file

The code for the administrator/components/com_foos/tmpl/foo/edit.php file is as follows:

Changing administrator/components/com_foos/tmpl/foos/default.php

The administrator/components/com_foos/tmpl/foos/default.php file is ....

Completed administrator/components/com_foos/tmpl/foos/default.php file

The code for the administrator/components/com_foos/tmpl/foos/default.php file is as follows:

Test your component

Now you can zip all files and install them via Joomla Extension Manager.

You have to run a new installation or fix the database due to the changes in the database.

After that you can

It would be good, to set a default categorie while installing your component. You can do this in the file script.php

Example in Joomla!

In the sidebar you now see another menu item. With this menu item you can create categories for your extension.

File:as_j4_t_12b_1.png

You can select this category when editing an item.

File:as_j4_t_12b_2.png

If a category is assigned, it will be displayed in the overview.

File:as_j4_t_12b_3.png

Component Contents

Concluding Remark

You can now classify the items into categories. Next, we'll look at how to change the state of an item. Next

Overview of all files