6 votes

How to allow media manager open video files

The best way to allow video selection in an extension field is to use a custom field. For an introduction to custom fields, take a look at this article from Joomla! Documentation. In its simplest ...
johanpw's user avatar
  • 13.3k
5 votes
Accepted

PageNavigation Plugin

Edited Assuming you have created a template override of the article view, then you have to modify a few things at templates\mytemplate\html\com_content\article\default.php Declare a global variable ...
Aung Myo Linn's user avatar
5 votes
Accepted

Is there an event like "OnAfterCompileHead"?

I have to edit my answer, as I think I didn't get right what you are actually want initially. With all the 3 events you can do changes on the head. If you have other plugins that do the same, then you ...
FFrewin's user avatar
  • 19.6k
4 votes
Accepted

Easiest way to add a class to the body

Remember that if you want to use vanilla JS, you need to use the equivalent of jQuery's document.ready() method. So you want to use document.addEventListener('DOMContentLoaded'), like so: <?php ...
Lodder's user avatar
  • 26.9k
4 votes

using the sourcerer plugin the code written in php disappears

From https://www.regularlabs.com/extensions/sourcerer/tutorial: Sourcerer already creates the $document (or $doc) object for you when it is needed. So you do not have to initialize this yourself. ...
mickmackusa's user avatar
  • 4,781
3 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 ...
mickmackusa's user avatar
  • 4,781
3 votes
Accepted

Is it possible to change the requested component and view with a system plugin?

The currently accepted solution is overcomplicated and bound to cause problems. Don't mess with fundamentals, like the URL and PHP superglobals when all you want to do is modify Joomla's routing ...
nikosdion's user avatar
  • 519
3 votes

Easiest way to add a class to the body

The jQuery part must be called in the document.ready() event. Try this: $javascript=' jQuery(document).ready(function(){ jQuery("body").addClass("' . $alias . '"); }); '...
Mohamed Abdelaziz's user avatar
2 votes

How to replace the content of Div for plugin

There are some grey details in your question, so I'll post a solution what I think will do as you desire using DOMDocument and a direct XPath query. Because your question appears to only have one ...
mickmackusa's user avatar
  • 4,781
2 votes

Assign different single article template per category

Yes, it's possible. You can do it with a system plugin. However there is already a such solution available by Regular Labs. It's called Advanced Template Manager, and it works similarly to the ...
FFrewin's user avatar
  • 19.6k
2 votes

What is the difference between onAfterGetMenuTypeOptions and onBeforeRenderMenuItems plugin triggers

The main difference between any plugin triggers is the timing at which they run. onAfterGetMenuTypeOptions is triggered after the menu types are returned, and onBeforeRenderMenuItems is triggered just ...
itoctopus's user avatar
  • 3,216
2 votes

How can I display a message based upon the value of a config item

This JFactory::getapp(); should be JFactory::getApplication(); or because the app property has already been made protected above you can just use it like $this->app->get('robots'); but ...
jamesgarrett's user avatar
  • 3,299
2 votes

addScriptDeclaration is not working

You are using onAfterRender event which is not suitable for modifying the document object because this event is triggered after the page has already been rendered. Use onAfterDispatch, onBeforeRender ...
Sharky's user avatar
  • 10.8k
2 votes
Accepted

addScriptDeclaration is not working

$document->addScriptDeclaration() method is working, no problem with that. window.event is deprecated: https://developer.mozilla.org/en-US/docs/Web/API/Window/event instead of that you should use ...
Zollie's user avatar
  • 2,896
2 votes

Creating a plugin to insert a Chrome Trial Token

Plugins can be fickle things to get right, so here's a short guide to getting your plugin working successfully. Identify the Plugin Type and Event Firstly work out which event you need to subscribe to....
Robbie Jackson's user avatar
2 votes

Creating a plugin to insert a Chrome Trial Token

If I were you I would try this instead of onBeforeRender: onBeforeCompileHead That way you are adding the meta to the document prior to it being rendered. Here is an excellent video explaining all ...
Eoin's user avatar
  • 1,889
2 votes
Accepted

onAfterRender plugin only triggers on backend

The code you currently have works. You just need to clear page cache and view the page again. You'll see fonts.googleapis.com links are removed. This may or may not be fine depending on the rest of ...
Sharky's user avatar
  • 10.8k
2 votes

Reducing frequency of the "Joomla! update available" mails to once per day or once per week

At System -> Update -> Extensions -> Options you can change the caching to 24 hours so you only get one email per day. There does not appear to be any other option apart from disabling the ...
Neil Robertson's user avatar
1 vote
Accepted

Does on after save work with the API call?

Looking at the API code for com_content it seems to just pass the data back to the com_content model/article in the Admin directory so I would think it would be triggering the same plugin.
Irata's user avatar
  • 3,597
1 vote
Accepted

How to add the alias to the body in a plugin

I'm not sure why you're using onBeforeCompileHead. As per the docs, https://docs.joomla.org/Plugin/Events/System, this is triggered before the head is even created. Maybe you thought this would be the ...
BodgeIT's user avatar
  • 677
1 vote

How to change the site language by country IP

If the client forces it, I would go with the @mickmackusa approach and check if the language has been set via a value in the session and only if it hasn't then execute your code to get the IP and ...
Irata's user avatar
  • 3,597
1 vote
Accepted

Develop a System Plugin with Sample Data for Options

I am not sure there is not a simpler way. But this way you'll get what you want. a) Create a custom field to implement your logic. You can extend from any basic custom field types. b) Simply set it ...
Riccardo Zorn's user avatar
1 vote
Accepted

onAfterRender plugin issue

Ok I've debugged this now. I'll write this down in simple steps: Change the PHP file name to koy_alias_as_body_class.php Change the XML file name to koy_alias_as_body_class.xml Change the class name ...
Lodder's user avatar
  • 26.9k
1 vote
Accepted

Flag based on Language and Two Factor Authentication

There is better way for getting $flagFactor. $flagFactor = JPluginHelper::isEnabled('twofactorauth'); This returns true if any of twofactorauth type plugins is enabled and accessible by current user ...
Rene Korss's user avatar
  • 3,208
1 vote

How to override language filter plugin?

Template overrides are for layout files. You can override a plugin's layout/template files, assuming the plugin is designed this way. But this cannot be used to change behavior of system plugins. ...
FFrewin's user avatar
  • 19.6k
1 vote

Installing Language Filter and Language Code system plugins

Ok my bad, they were installed. I failed to find them because their names were translated into French in the administration panel...
Virus721's user avatar
  • 121
1 vote

Plugin to change incoming url

/** * Fucntionality which needs to be triggered on After the system has been loaded. * * @since 1.0.0 */ public function onAfterInitialise() { $app = JFactory::getApplication(); // ...
Robert Dam's user avatar
1 vote
Accepted

How to remove rel="nofollow" with Joomla Buffer?

onContentAfterDisplay isn't called at a point when the full getBody() content has been generated. It is rather called at the points where components and modules are generating their individual views. ...
RichardB's user avatar
  • 3,072
1 vote

What is the correct (preffered) entry in SEF plugin for Site Domain

That question has been asked so many times and created very long arguments that were never won by anyone. My thought: Take a look at google's website, and see if they use www, and do what they're ...
itoctopus's user avatar
  • 3,216

Only top scored, non community-wiki answers of a minimum length are eligible