mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Provide a new API for plugins to add HTML to the <head> of the site
This commit is contained in:
@@ -1,14 +1,23 @@
|
||||
from django.conf import settings
|
||||
from django.core.urlresolvers import resolve
|
||||
from .signals import html_head
|
||||
|
||||
|
||||
def contextprocessor(request):
|
||||
"""
|
||||
Adds data to all template contexts
|
||||
"""
|
||||
url = resolve(request.path_info)
|
||||
if url.namespace != 'control':
|
||||
return {}
|
||||
ctx = {
|
||||
'url_name': resolve(request.path_info).url_name,
|
||||
'url_name': url.url_name,
|
||||
'settings': settings,
|
||||
}
|
||||
_html_head = []
|
||||
if hasattr(request, 'event'):
|
||||
for receiver, response in html_head.send(request.event):
|
||||
_html_head.append(response)
|
||||
ctx['html_head'] = "".join(_html_head)
|
||||
|
||||
return ctx
|
||||
|
||||
Reference in New Issue
Block a user