Skip to content

Adds an onAfterRenderModule trigger#8296

Merged
wilsonge merged 3 commits intostagingfrom
unknown repository
Jan 28, 2016
Merged

Adds an onAfterRenderModule trigger#8296
wilsonge merged 3 commits intostagingfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Nov 6, 2015

This PR adds an extra event trigger to the module rendering process.
This way plugins can manipulate the rendered output of modules separately.

To test, create a system plugin foobar with this:

class PlgSystemFooBar extends JPlugin
{
    public function onAfterRoute()
    {
        JFactory::getApplication()->registerEvent('onAfterRenderModule', array($this, 'onAfterRenderModule'));
    }

    public function onAfterRenderModule(&$module)
    {
        if (is_null($module))
        {
            return;
        }

        $module->content = '<p style="color:red">Module content replaced</p>';
    }
}

Or add the registerEvent and onAfterRenderModule code to an existing plugin.

This PR adds an extra event trigger to the module rendering process.
This way plugins can manipulate the rendered output of modules separately.
@Kubik-Rubik
Copy link
Copy Markdown
Member

@nonumber Makes sense to have such a trigger, thank you! Please remove the whitespaces in line 260.

@richard67
Copy link
Copy Markdown
Member

@nonumber Just seen that there is PR #3105 for the same purpose (but with a different solution) with milestone Joomla! 3.6.0. Is this one here now a duplicate, and the old one should be closed if this one is accepted?

@ghost
Copy link
Copy Markdown
Author

ghost commented Nov 6, 2015

That PR is for the complete module position. Modules (plural) as opposed to module.
So not a duplicate. Different use.

@richard67
Copy link
Copy Markdown
Member

Ah, ok, I see. Thanks for the clarification.

@wilsonge wilsonge modified the milestone: Joomla! 3.6.0 Nov 6, 2015
@zero-24 zero-24 added this to the Joomla! 3.6.0 milestone Nov 7, 2015
@brianteeman
Copy link
Copy Markdown
Contributor

Are these three issues related #8693 #8296 #3105


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8296.

@ghost
Copy link
Copy Markdown
Author

ghost commented Dec 18, 2015

#8296 is the same as #8693.

#3105 is something different:

That PR is for the complete module position. Modules (plural) as opposed to module.
So not a duplicate. Different use.

@kanich
Copy link
Copy Markdown
Contributor

kanich commented Dec 18, 2015

Exactly as @nonumber expressed above - #3105 is dealing with class JDocumentRendererModules in libraries/joomla/document/html/renderer/modules.php file. All other PRs are different.

@waader
Copy link
Copy Markdown
Contributor

waader commented Jan 6, 2016

I have tested this item ✅ successfully on abfc4ee

Thanks nonumber!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8296.

@ced1870
Copy link
Copy Markdown

ced1870 commented Jan 7, 2016

I have tested this item ✅ successfully on abfc4ee


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8296.

@ghost
Copy link
Copy Markdown
Author

ghost commented Jan 26, 2016

Any chance this can get merged before it gets out of sync?

@ced1870
Copy link
Copy Markdown

ced1870 commented Jan 27, 2016

+1 with Peter. This is a needed improvement

@brianteeman
Copy link
Copy Markdown
Contributor

(someone has set this to 3.6 milestone)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8296.

@ced1870
Copy link
Copy Markdown

ced1870 commented Jan 27, 2016

thank you Brian.
Sorry for my ignorance about all this process. Does this mean that it will integrated, or is it still waiting for something like says the "pr-staging" label ?

@brianteeman
Copy link
Copy Markdown
Contributor

What it means is that someone has decided that this can only be merged in Joomla 3.6

@ghost
Copy link
Copy Markdown
Author

ghost commented Jan 27, 2016

So should I change this so it is a PR to the 3.6.x branch?
Or does this just stay open till someone feels like merging it to that branch?

@brianteeman
Copy link
Copy Markdown
Contributor

As far as I know its the latter

On 27 January 2016 at 11:50, Peter van Westen notifications@github.com
wrote:

So should I change this so it is a PR to the 3.6.x branch?
Or does this just stay open till someone feels like merging it to that
branch?


Reply to this email directly or view it on GitHub
#8296 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

wilsonge added a commit that referenced this pull request Jan 28, 2016
Adds an onAfterRenderModule trigger
@wilsonge wilsonge merged commit 410ce3b into joomla:staging Jan 28, 2016
@wilsonge wilsonge modified the milestones: Joomla! 3.5.0, Joomla! 3.6.0 Jan 28, 2016
@ghost
Copy link
Copy Markdown
Author

ghost commented Jan 28, 2016

Thanks :)

@ghost ghost deleted the patch-1 branch January 28, 2016 20:26
@Kubik-Rubik
Copy link
Copy Markdown
Member

@wilsonge Since it is merged now for Joomla! 3.5, we should not forget to update the documentation for core triggers! @MATsxm

@MATsxm
Copy link
Copy Markdown

MATsxm commented Jan 29, 2016

👍
As a non dev, I will let you got for it but let me know if any help is needed.
https://docs.joomla.org/Plugin/Events
Thanks all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants