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.
What is a Joomla plugin?
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.
Plugin types in the Joomla 4 core
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 documentationdocs.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 thisdeveloper.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.0oauth.net 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 Checken.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 reCaptchagoogle.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: comfinder. In Joomla 3 this was comsearch. The main difference between the two is that comsearch searches the content in real time and may open many different database tables to do so, while comfinder 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 reductionen.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,
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.
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.