Add label-overrides to contact_form_fields_overrides and question_form_fields_overrides (Z#23244154)

This commit is contained in:
Martin Gross
2026-08-28 15:34:50 +02:00
parent 2e8e6a6b07
commit 7eec8186cd
3 changed files with 10 additions and 4 deletions
+2
View File
@@ -135,6 +135,8 @@ class BaseQuestionsViewMixin:
question_field.initial = getattr(question_field, 'initial', None) or src['initial']
if 'validators' in src:
question_field.validators += src['validators']
if 'label' in src:
question_field.label = src['label']
if len(form.fields) > 0:
formlist.append(form)
+4
View File
@@ -840,6 +840,8 @@ class QuestionsStep(CartQuestionsViewMixin, CartMixin, TemplateFlowStep):
f.fields[fname].disabled = val['disabled']
if 'validators' in val and fname in f.fields:
f.fields[fname].validators += val['validators']
if 'label' in val and fname in f.fields:
f.fields[fname].label = val['label']
return f
@@ -944,6 +946,8 @@ class QuestionsStep(CartQuestionsViewMixin, CartMixin, TemplateFlowStep):
f.fields[fname].disabled = val['disabled']
if 'validators' in val and fname in f.fields:
f.fields[fname].validators += val['validators']
if 'label' in val and fname in f.fields:
f.fields[fname].label = val['label']
return f
+4 -4
View File
@@ -233,7 +233,7 @@ Arguments: ``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``,
value-dictionary should contain one or more of the following keys: ``label``, ``initial``, ``disabled``,
``validators``. The key of the dictionary should be the name of the form field.
As with all event plugin signals, the ``sender`` keyword argument will contain the event. A ``request``
@@ -264,9 +264,9 @@ Arguments: ``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``, ``validators``. The key of the dictionary
should be the form field name for system fields (e.g. ``company``), or the question's ``identifier``
for user-defined questions.
more of the following keys: ``label``, ``initial``, ``disabled``, ``validators``. The key of the
dictionary should be the form field name for system fields (e.g. ``company``), or the question's
``identifier`` for user-defined questions.
The ``position`` keyword argument will contain a ``CartPosition`` or ``OrderPosition`` object.