Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Event onAfterRenderModule #8693

Closed
wants to merge 1 commit into from
Closed

Conversation

ced1870
Copy link

@ced1870 ced1870 commented Dec 15, 2015

Allows the plugins to catch the module object (content and params) before it renders into the page. This is very useful for design purposes

Allows the plugins to catch the module object (content and params) before it renders into the page. This is very useful for design purposes
@brianteeman
Copy link
Contributor

It would be useful if you could provide an example of how to test this functionality

@ced1870
Copy link
Author

ced1870 commented Dec 15, 2015

Hi Brian,
Here an example of use :
1/ create a sytem plugin
2/ write
function onAfterRenderModule($module, $attribs) {
$module->content = '

' . $module->content . '
';
}
3/ this will render a div around the module that can be used to add some styles or link to some JS to make it float

This is a basic example, where of course you would need in your plugin to test if you are in admin or front, make some additional condition to target the needed module and have the best conditions to do it (like any good developer would do in any plugin ;) )

Hope that this is clear and that you will think about implementing it.
Please let me know
Regards
CEd

@Fedik
Copy link
Member

Fedik commented Dec 15, 2015

personally, I think that for such cases the ModuleChrome https://docs.joomla.org/Module_chrome cover all needs here

@ced1870
Copy link
Author

ced1870 commented Dec 15, 2015

@Fedik : how to you catch and render the module from a plugin ? the module Chrome covers all needs if you are inside a template only
I use the JModuleHelper class in many cases and sometimes it needs to change the module content

@Bakual
Copy link
Contributor

Bakual commented Dec 15, 2015

I tend to agree with @Fedik here, at least for the use case you mentioned. The module chrome is exactly meant to provide design around a module content. Like adding a div around the content.
If you need to alter the output of the module itself, template overrides are the way to go, assuming the module is coded right.

I don't see yet the usecase where you would need a plugin event, but feel free to make an example.

@ced1870
Copy link
Author

ced1870 commented Dec 15, 2015

I have made a little example above :)

Imagine that you want to develop a plugin that will add some options into a module (any module in this case), then using the plugin you can check the options and do some work. In my case I add a button to make the module sticky.
If the user click the button in the module options, the plugin alter the module code before rendering in the page to add the sticky class.

this is a simple example, now if you know of to do all this using Module Chrome, let me know :)
I don't see where is the problem to add this event, is there anyone ?

@Bakual
Copy link
Contributor

Bakual commented Dec 15, 2015

Thanks for the example. It makes more sense now.

@brianteeman
Copy link
Contributor

Are these three issues related #8693 #8296 #3105


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

@ghost
Copy link

ghost commented Dec 18, 2015

Is pretty much a carbon copy of: #8296

@ced1870
Copy link
Author

ced1870 commented Dec 18, 2015

I have not seen the other requests that are similar. For me, no matter who's name is for the pull request, the only thing that is important to me is that this trigger is added to allow more customization and user interaction. Thank you

@ced1870
Copy link
Author

ced1870 commented Jan 6, 2016

Hi
Is there any news about the implementation of this trigger ?
Thank you
CEd

@Bakual
Copy link
Contributor

Bakual commented Jan 6, 2016

Without any human tests, it will usually go nowhere.

@ced1870
Copy link
Author

ced1870 commented Jan 6, 2016

Ok so please tell me wo needs to test and how.

@Bakual
Copy link
Contributor

Bakual commented Jan 6, 2016

Anyone (beside you as it's your own PR and we assume you tested it) can test this PR by using the Joomla patchtester (http://joom.la/patchtester).
They should then log their results in https://issues.joomla.org/tracker/joomla-cms/8693

Usually we require two good tests for anything to be merged.

Since this introduces a new feature/API point, it can go into Joomla 3.6.0 earliest (3.5.0 is feature locked already as it is in beta).

@ced1870
Copy link
Author

ced1870 commented Jan 6, 2016

ok thank you for the informations

@andrepereiradasilva
Copy link
Contributor

The process for testers is described here https://docs.joomla.org/Testing_Joomla!_patches

Normally it helps getting testing if you have a clear "How to test" or "Testing instructions" block in the PR description with clear and simple instructions on how to test (and screenshots if needed).

Example: #8350

@ghost
Copy link

ghost commented Jan 6, 2016

But this PR can get closed as it is a duplicate of #8296

@Bakual Bakual closed this Jan 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants