From 5ae7a350b082044944a12327257510c443866c51 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Thu, 4 Feb 2021 17:32:10 +0100 Subject: [PATCH] Add signal global_footer_link --- doc/development/api/general.rst | 2 +- src/pretix/presale/context.py | 9 +++++++-- src/pretix/presale/signals.py | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/development/api/general.rst b/doc/development/api/general.rst index b9712fe9b..7ce56c4fb 100644 --- a/doc/development/api/general.rst +++ b/doc/development/api/general.rst @@ -34,7 +34,7 @@ Frontend -------- .. automodule:: pretix.presale.signals - :members: html_head, html_footer, footer_link, front_page_top, front_page_bottom, front_page_bottom_widget, fee_calculation_for_cart, contact_form_fields, question_form_fields, contact_form_fields_overrides, question_form_fields_overrides, checkout_confirm_messages, checkout_confirm_page_content, checkout_all_optional, html_page_header, sass_preamble, sass_postamble, render_seating_plan, checkout_flow_steps, position_info, position_info_top, item_description, global_html_head, global_html_footer, global_html_page_header + :members: html_head, html_footer, footer_link, global_footer_link, front_page_top, front_page_bottom, front_page_bottom_widget, fee_calculation_for_cart, contact_form_fields, question_form_fields, contact_form_fields_overrides, question_form_fields_overrides, checkout_confirm_messages, checkout_confirm_page_content, checkout_all_optional, html_page_header, sass_preamble, sass_postamble, render_seating_plan, checkout_flow_steps, position_info, position_info_top, item_description, global_html_head, global_html_footer, global_html_page_header .. automodule:: pretix.presale.signals diff --git a/src/pretix/presale/context.py b/src/pretix/presale/context.py index 4488bf679..af806710a 100644 --- a/src/pretix/presale/context.py +++ b/src/pretix/presale/context.py @@ -14,8 +14,8 @@ from pretix.helpers.i18n import ( from ..base.i18n import get_language_without_region from .signals import ( - footer_link, global_html_footer, global_html_head, global_html_page_header, - html_footer, html_head, html_page_header, + footer_link, global_footer_link, global_html_footer, global_html_head, + global_html_page_header, html_footer, html_head, html_page_header, ) logger = logging.getLogger(__name__) @@ -65,6 +65,11 @@ def _default_context(request): _html_head.append(response) for receiver, response in global_html_footer.send(None, request=request): _html_foot.append(response) + for receiver, response in global_footer_link.send(None, request=request): + if isinstance(response, list): + _footer += response + else: + _footer.append(response) if hasattr(request, 'event') and get_scope(): for receiver, response in html_head.send(request.event, request=request): diff --git a/src/pretix/presale/signals.py b/src/pretix/presale/signals.py index 4c2e0ae52..c0817269c 100644 --- a/src/pretix/presale/signals.py +++ b/src/pretix/presale/signals.py @@ -105,6 +105,14 @@ are expected to return a dictionary containing the keys ``label`` and ``url``. As with all plugin signals, the ``sender`` keyword argument will contain the event. """ +global_footer_link = Signal( + providing_args=["request"] +) +""" +The signal ``pretix.presale.signals.global_footer_link`` allows you to add links to the footer of any page. You +are expected to return a dictionary containing the keys ``label`` and ``url``. +""" + checkout_confirm_messages = EventPluginSignal() """ This signal is sent out to retrieve short messages that need to be acknowledged by the user before the