You have created a plug-in in the previous section. You have probably already configured other plugins in the plugin manager and know the different types. Plugins cover many different areas in Joomla. This chapter provides an overview of what plugins are and how they work within Joomla.
In the Joomla Documentation[^docs.joomla.org/plugin/events] you will find a list of all plugin groups with all associated events. Use this list as a quick reference when you have a task to do.
You already know that there are different types of extensions: Components, modules, templates, languages and plugins. While components, modules, templates and languages usually cause a direct output, a plugin typically works in the background. Plugins are versatile. Each plugin has its own purpose. Let's organise plugins a little. Even within Joomla, they are divided into plugin groups. It's much easier to understand the purpose if you look at each type separately. For example, content plugins and system plugins. Fortunately, it is not difficult to write a sample plugin. You already saw that in the last chapter. In this chapter, we will get an overview of the different types and their special features.
The Joomla core comes with a lot of plugins. These are divided into 22 plugin types and so is this part of the text. For example, there is a chapter about content plugins and another one about system plugins.
For an overview of all plugins available in Joomla core and their associated events/events, see the Joomla documentation[^docs.joomla.org/help4.x:plugins:_name_of_plugin]. Check out the code if you need some programming inspiration.
In my opinion, it helps to understand Joomla plugins if you study each type on its own. That is why we are doing this now. The types or groups are classified as follows:
Plugins of the Action Log type record user activities in the Joomla Core extensions of the page to review them later if needed. If you want to log activities in a third-party extension, create a plugin of this type for it.
API Authentication type plugins are used to provide authentication for web services in Joomla. Remember: You activated a Joomla core plugin of this type in the previous chapter on web services.
When someone logs into Joomla, the Joomla application authenticates that user. On most websites, authentication is performed against the Joomla database. This type of authentication is performed by the authentication plugin. With an authentication plugin, it is possible to use external services to authenticate users: Joomla provides an authentication plugin for LDAP, which is used in Windows domains.
Joomla 3 had plugins for authentication via Gmail on board. Joomla 4 no longer offers this[^developer.joomla.org/news/724-removal-of-the-gmail-authentication-plugin-as-of-joomla-4-0.html]. The technology used by the plugin is no longer state of the art and less secure. Nowadays, applications should authorize themselves via the OAuth 2.0[^en.wikipedia.org/wiki/oauth] protocol with Google.
Behavior type plugins are used to enable a specific behavior in the website. Examples in Joomla core are tagging or versioning of elements.
Plugins of this group allow to check forms with a Captcha Check[^en.wikipedia.org/wiki/captcha] (engl. completely automated public Turing test to tell computers and humans apart), a fully automated public Turing test that detects whether a human or a machine submits the form. The Joomla core comes with a plugin for Google reCaptcha[^google.com/recaptcha/about/]. Custom captcha methods are easily added.
Captchas are a nice way to add an individual touch to the website. If it is too much work to create images that match the topic, you can work with questions. On the website of a fire department association a possible question would be, about the color of the fire truck.
A content plugin is mostly used to change the content of the article before it is displayed or before it is saved in the database. Those who have special requirements can use a plugin of this type for custom functions after the article is saved in the database. Whenever you want to customize the processing of the content, choosing this type of plugin is perfect.
Editor | None.
At the bottom of a Joomla editor, buttons appear in addition to the toolbar - for example, a button to add a
read more link or a button to add a page break. These buttons are generated by plugins of the editors-xtd type.
There are not many plugins in this group, nevertheless it is an interesting group. Whenever a Joomla extension is installed or removed, it is possible to hook into the installation via a plugin of this group.An extension plugin does a task during an installation! The Joomla plugin of extension type is used to clean up update pages. Update pages are URLs that are stored in the extension manager for updating extensions. Since Joomla 3.2 it is possible for commercial extensions to use this plugin to allow private downloads with a security key.
Extensions - Namespace Updater automatically creates and updates the file
The Fields plugin type allows you to create fields in extensions that support custom fields. For example, a calendar can be added when creating an item, through which a date is stored with the item, which is output at a specific location in the content. This makes it easier to output content in the same layout or to query content in other extensions. For example, a field that stores a geographic coordinate will display a marker at that position on a digital map in a module.
Plugins of the Filesystem type are used to define one or more local directories for storing files. Do you want to offer the flexible changing of a directory for your extension. Then check out the Joomla core plugin
Filesystem - Local with which you can set the directory where image files are stored.
The default search in Joomla 4 is the Search Index or Smart Search component: com_finder. In Joomla 3 this was com_search. The main difference between the two is that com_search searches the content in real time and may open many different database tables to do so, while com_finder creates index tables first and then searches only that index. The latter allows for a more efficient and therefore faster full-text search. The new search index is more complex than the old classic search, which required no configuration but offered few options. com_finder uses an active index based on stem reduction[^en.wikipedia.org/wiki/stemming]. Specifically, the PHP library php-stemmer[github.com/wamania/php-stemmer] is applied. The idea is to increase the performance and quality of the search result by covering multiple syntactic words with a base form. For example,
garden have related meanings. Each type of content requires its own Finder plugin. Create a Finder plugin if you want content in your component to be found,
com_search is still available[^github.com/joomla-extensions/search] as a decoupled component, and it also requires a separate plugin for third-party extension content to be found.
Do you want to change the installation process of your extension? Then take a look at the installer type plugins.
Cropping images, changing the size or rotating them is each possible with a core Joomla plugin from the Media Action. Expand this plugin group if the media or image editing functions are not enough for you.
If your self-programmed extension processes personal data, then plugins of the type Privacy come into play. Create a plugin of this type and make sure in the code that this data is correctly processed by Joomla in the core privacy component. This is the only way Joomla can handle user requests for stored data or deletion requests. For Joomla core extensions the required plugins are available in Joomla 4.
Use a plugin of the type quickicon to place a quickicon on the dashboard of the Joomla backend.
The Joomla Core Sample Data module provides a unified workflow for adding sample files. Want to jump in here and make sample files installable for your extension with a click? Then, you probably guessed it already, a plugin of the type sample files is required.
Do you have tasks that have to be done again and again? Or tasks for the future that you would like to plan and definitely must not forget? Since Joomla 4.1, you can automate these with the new task planner. And what is essential for developers: All Joomla extensions can take advantage of it and schedule tasks and execute them regularly. Especially if the website host does not allow cron jobs. It is possible to use the core scheduler to schedule tasks in your own extensions. Task Plugins are integrated into Joomla via PR 35143[^github.com/joomla/joomla-cms/pull/35143].
In addition to standard authentication, there is the possibility to achieve additional security by adding a parallel second authentication.
Is there a connection between the data in a component and the users in the Joomla user management? Technically, this is implemented with a plug-in of the user type. Are you wondering how this works? Then take a look at the plugin for the contact component, which links a contact to a user.
A Web Services plug-in adds the routes of an extension to the website's API. We practically used this plugin in the previous part.
In workflow management, there are different transitions that can be manipulated using a plugin.