Hooks tags
hypha.core.templatetags.hooks_tags
¶
hook_tag
¶
Hook tag to call within templates
:param dict context: This is automatically passed,\ contains the template state/variables :param str name: The hook which will be dispatched :param *args: Positional arguments, will be passed to hook callbacks :param **kwargs: Keyword arguments, will be passed to hook callbacks :return: A concatenation of all callbacks\ responses marked as safe (conditionally) :rtype: str
Source code in hypha/core/templatetags/hooks_tags.py
template_hook_collect
¶
Helper to include in your own templatetag, for static TemplateHooks
Example::
import myhooks
from hooks.templatetags import template_hook_collect
@register.simple_tag(takes_context=True)
def hook(context, name, *args, **kwargs):
return template_hook_collect(myhooks, name, context, *args, **kwargs)
:param module module: Module containing the template hook definitions :param str hook_name: The hook name to be dispatched :param *args: Positional arguments, will be passed to hook callbacks :param **kwargs: Keyword arguments, will be passed to hook callbacks :return: A concatenation of all callbacks\ responses marked as safe (conditionally) :rtype: str