Allow plugins to disable and pre-fill questions and contact form fields (#1824)

Co-authored-by: Raphael Michel <michel@rami.io>
Co-authored-by: Raphael Michel <mail@raphaelmichel.de>
This commit is contained in:
Martin Gross
2020-10-26 09:30:16 +01:00
committed by GitHub
parent c2069663f3
commit 4fed690209
5 changed files with 143 additions and 6 deletions

View File

@@ -180,6 +180,21 @@ As with all plugin signals, the ``sender`` keyword argument will contain the eve
argument will contain the request object.
"""
contact_form_fields_overrides = EventPluginSignal(
providing_args=["request", "order"]
)
"""
This signal allows you to override fields of the contact form that is presented during checkout
and by default only asks for the email address. It is also being used for the invoice address
form. You are supposed to return a dictionary of dictionaries with globally unique keys. The
value-dictionary should contain one or more of the following keys: ``initial``, ``disabled``. The
key of the dictionary should be the name of the form field.
As with all plugin signals, the ``sender`` keyword argument will contain the event. A ``request``
argument will contain the request object. The ``order`` argument is ``None`` during the checkout
process and contains an order if the customer is trying to change an existing order.
"""
question_form_fields = EventPluginSignal(
providing_args=["position"]
)
@@ -196,6 +211,22 @@ later.
As with all plugin signals, the ``sender`` keyword argument will contain the event.
"""
question_form_fields_overrides = EventPluginSignal(
providing_args=["position", "request"]
)
"""
This signal allows you to override fields of the questions form that is presented during checkout
and by default only asks for the questions configured in the backend. You are supposed to return a
dictionary of dictionaries with globally unique keys. The value-dictionary should contain one or
more of the following keys: ``initial``, ``disabled``. The key of the dictionary should not be the
question's form field name (``question_n``) but rather the questions ``identifier``.
The ``position`` keyword argument will contain a ``CartPosition`` or ``OrderPosition`` object.
As with all plugin signals, the ``sender`` keyword argument will contain the event. A ``request``
argument will contain the request object.
"""
order_info = EventPluginSignal(
providing_args=["order", "request"]
)