6
votes
Accepted
Trigger event for specific plugin only
Generally, an event dispatcher does not support this concept. You're better off directly calling that single function versus going through a dispatcher if you really only want one response from one ...
6
votes
Accepted
Custom message after plugin installation
Yes, it is absolutely possible. You have to create/use an install script.php file in your installable plugin folder which will include tasks on different points of installation, uninstallation, update,...
6
votes
Accepted
How to adjust search keyword sanitization settings as language override?
Look for methods called set<PROPERTY>Callback on the same API documentation you linked. E.g. to override the lower limit use Joomla\CMS\Language\Language::setLowerLimitSearchWordCallback().
I'm ...
5
votes
Accepted
Why is my plugin not hooking into events?
Plugin class name must match the plugin name defined in manifest file.
If you have this in the manifest:
<filename plugin="installer_log">installer_log.php</filename>
Then class name ...
5
votes
Content plugin doesn't add text to articles
Your plugin appears to be written for a very old version of Joomla! The event in current versions is onContentBeforeSave. You are also missing $context argument. It's a good idea to check for context ...
4
votes
How to use Github as an auto-update deployment server for Joomla 3.x extension
Have a look at the Weblinks repo
It does exactly what you want to do.
The updateserver points to the manifest hosted on that repo.
Download packages are served from the repo as well.
Of course you ...
4
votes
Accepted
Get Title from ID
You could try something like the following:
public function onYOURFUNCTION($context, &$article, &$params)
{
$id = JFactory::getApplication()->input->getInt('id');
$load = $...
4
votes
Accepted
Language files in a plugin
Since Joomla 3.1 it is not necessary to expand the constructor any more, like farahmand's answer.
You can easily write / set the $autoloadLanguage like
class myPlugin extends JPlugin
{
/**
*...
4
votes
Accepted
Override JHtml (HTMLHelper) class methods
Create a system plugin and use JHtml::register() to register your custom methods.
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\CMSPlugin;
class PlgSystemExample ...
4
votes
Accepted
Joomla4 plugin getBody
According to the documentation, JApplicationWeb seems to be alive and well in Joomla4.
since 2.5.0
note As of 4.0 this class will be abstract
The getters:
JApplicationWeb::getBody()
Or
...
4
votes
Accepted
What is the different between JPlugin and \Joomla\CMS\Plugin\CMSPlugin
JPlugin is an alias of Joomla\CMS\Plugin\CMSPlugin. It is the same thing at the moment, but one should start using fully qualified class names because all aliases in Joomla! are deprecated and will be ...
3
votes
Accepted
How to to create a multi-layered form system
The short answer is: you will need the assistance of a Joomla Programmer as it's highly improbable you'll find a plug-in that suits your requirements.
First of all, I think what you are looking for ...
3
votes
Accepted
How to add any text/script before </body>
Plugin code
<?php
// no direct access
defined('JPATH_BASE') or die;
class plgSystemMyplugin extends JPlugin
{
function onAfterRender()
{
$app = JFactory::getApplication();
...
3
votes
Accepted
Dynamic fields in module parameters
No answers here, but I have managed to work it out for myself. The answer is actually to use both of the solutions I had in mind already -- a custom field type and a subform.
My solution works like ...
3
votes
Dynamic article filter
I used Minitek Wall.
Seems to work really well - I am not technically well versed so I stand to be corrected on that part. Very quick.
Only frustrating thing is the lack of pagination in the free ...
3
votes
Accepted
Use plugin code in overrides content template
Content plugins work in all article views whether or not they are overrides. To use them in custom components (whether in overrides or not) you can use the technique explained here: https://docs....
3
votes
Language files in a plugin
Load the language files in the plugin's constructor like so:
function __construct(&$subject, $config) {
$lang = JFactory::getLanguage();
$lang->load('plg_system_myplugin', dirname(...
3
votes
Logout within plugin interfering with other plugins
The Joomla plugins run as they are ordered in the Joomla backend. Change the ordering - and ensure that the ordering of your plugin is last. This will ensure that all other plugins will run before ...
3
votes
Accepted
Is there an event for saving a menu item?
onContentAfterSave() is the right one.
It appears in com_menus, in the menu item model's save function:
(administrator\components\com_menus\models\menu.php - line 240)
// Trigger the after save ...
3
votes
How to show previous/next buttons in my articles?
To display Next / Previous buttons at the bottom of articles pages, then first of all the content pagination plugin should be enabled.
Then for each of the articles, the corresponding value of show ...
3
votes
Adding custom fields to core components based on category
I now created a field inside the plugin where i can select the categories where the fields are shown. In my plugin i select these categories and just show the form when the post belong to one of these ...
3
votes
Accepted
onUserAfterLogin popup - Joomla 3.6.4 Plugin
The return value of onUserAfterLogin() should be a boolean -- ie true or false. The idea is that you can use this event handler to do additional validation on the login, so if you return false, it ...
3
votes
Accepted
How can I programmatically install a plugin?
Use Install model.
if (!defined('_JEXEC'))
{
define('_JEXEC', 1);
define('JPATH_BASE', realpath(__DIR__));
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . ...
3
votes
Accepted
Caching items with different cache lifetime
Yes, you can cache your data for your plugin, by creating a new JCache instance and setting your custom options.
Something like below would do that:
// Reading global configuration params
$conf = ...
3
votes
Accepted
How to make my Editor plugin (type: editors-xtd) survive after updates?
Normally, the plugin would open a list of items. In this case, the component doesn't have the model/view for the items. So you have to create them.
As a bare minimum, the model must contain ...
3
votes
Accepted
How to check by onContentAfterSave it is a article?
You use the $context variable for that. So you have to start your function like this:
public function onContentAfterSave ($context, $article, $isNew)
{
if ($context == "com_content.article") {
...
3
votes
Accepted
How to integrate google reviews into the page?
Using a Joomla Extension
There are currently very few Joomla extensions that help with displaying Google Reviews. Examples include Google Business Reviews (from €34.95) and Google Reviews Pro (from $...
3
votes
Accepted
Where are plugins found in Joomla 4?
You probably work with Joomla 4 (alpha) as beta does not seem to be yet available. The plugins in Joomla 4 (alpha 7 latest) are at administrator->system->manage->plugins.
3
votes
Limiting onContentAfterSave to one result
I am reading your code and I think it makes no sense... I can see only problems in your question, the code and in the approach for what I assume you want to achieve.
I will try to translate what ...
3
votes
Accepted
How to programmatically set the value of a custom field of type checkbox?
Basically you needed to use onContentAfterSave rather then onContentBeforeSave and use the FieldsHelper in conjuction with the FieldsModelField.
Here is the code:
<?php
defined( '_JEXEC' ) or die(...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
plugin × 417joomla-3.x × 153
development × 60
plugin-events × 41
module × 32
component × 31
extensions × 31
system-plugin × 24
php × 23
custom-field × 22
joomla-4.x × 22
articles × 21
user × 19
joomla-api × 16
joomla-2.5 × 14
overrides × 14
javascript × 12
form × 12
com-content × 12
custom-component × 11
installation × 10
editor × 9
authentication × 9
joomla-3.4 × 8
xml × 8