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

Already on GitHub? Sign in to your account

mod_admin(_frontend): More flexible block handling #666

wants to merge 1 commit into


None yet
4 participants

hanikesn commented Sep 23, 2013

This change allows other modules to provide custom javascript/wires for their own blocks.

Suggestions are welcome!

@hanikesn hanikesn mod_admin(_frontend): More flexible block handling
This change allows other modules to provide custom javascript/wires for their own blocks.

@kaos kaos commented on the diff Sep 23, 2013

@@ -10,6 +10,8 @@
{% endwith %}
+{% all include "_admin_edit_blocks_additional.tpl" %}

kaos Sep 23, 2013


I would go with adding an empty {% block additional %}{% endblock %} here. That way you don't have the template go running around looking for all include unnecessarily..

To use it, simply drop override it with your own version of _admin_edit_blocks.tpl and then use overrules to inject your code into the "additional" block.


hanikesn Sep 23, 2013


Would this also work if multiple modules want to extend this? I wrote a small slider module (https://bitbucket.org/zeitmacht/mod_zm_slider).

Which uses observe_admin_edit_blocks to register a new block type and provides a admin_edit_block_li...tpl and a block_view...tpl. But I need to put additional javascript/wires to the edit page, to provide custom functionality. Specifically:

Would there be any better way to do this? I guess I could put this somewhere else so that it gets included on the edit page.


kaos Sep 23, 2013


Not sure what happens if there's a chain of modules using overrules.. @mworrell ?

There is a _admin_edit_js.tpl file included from admin_edit.tpl which sounds nice. Maybe patch that to be a all include instead of just include.


mworrell Sep 23, 2013


A chain is just like you say it is - a chain.

You can always use {% inherit %} to echo the block value of the template next-up in the chain.

I agree that the js-files might be the best place to add extra javascript, now that you mentioned it.


hanikesn commented Oct 23, 2013

So, I'm trying to wrap up this pull request. I witnessed myself, that all include is very slow. (I deleted two all includes from my base template and reduced response times by ~50ms).

I agree, that the overrules method is better. But I'm hesitant to put it in admin_edit.tpl as it belongs to the block editing. What about a new file: _admin_edit_blocks_js.tpl included in admin_edit_blocks.tpl with all the javascript from _admin_edit_blocks.tpl, too?


arjan commented Sep 30, 2014

Closing due to inactivity.
See #830 for mention of all include performance

@arjan arjan closed this Sep 30, 2014

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