Currently extension authors can inject HTML code only in few predefined places. That is not enough.
I suggest to implement 2 events:
1. template_compile - event to be ran before template compilation. Parameters should be template name and template content. It would allow extension author to change content of template before it is compiled, inserting code anywhere.
2. template_post_render - event to be ran after template is parsed. Parameters should be template name and HTML code outputted by template engine. It would allow extension author to change HTML output after template is rendered.
Possible downside is there could be conflicts between styles and extensions trying to replace code that doesn't exist in style or between extensions and other extensions trying to change same code. So I think those events should be last resort, used only when there are no template events that extension can use.
It wasn't possible to implement with old template system, but with TWIG it should be doable.
[RFC] Events for template compilation and rendering
- imkingdavid
- Registered User
- Posts: 1050
- Joined: Thu Jul 30, 2009 12:06 pm
Re: [RFC] Events for template compilation and rendering
1. should be "template_compile_before"
2. should be "template_render_after"
I'm okay with implementing this. Eventually we should add an admin interface to somehow enable/disable extensions being able to use these events in case one conflicts or breaks things.
2. should be "template_render_after"
I'm okay with implementing this. Eventually we should add an admin interface to somehow enable/disable extensions being able to use these events in case one conflicts or breaks things.
-
- Registered User
- Posts: 165
- Joined: Fri Apr 05, 2013 3:38 am
Re: [RFC] Events for template compilation and rendering
This will be very useful if it can be done!