Skip to content

Commit f96a1c2

Browse files
committed
custom-fields: forward the field ID to React
* Added an injection of the field ID (e.g. `cern:department`) to the React UI widget chosen for the custom field via a new `id` prop. * This is consumed by the new function in inveniosoftware/react-invenio-forms#298 and used to allow developers to dynamically parametrize their own custom fields based on the form state. * This is not a breaking change and shouldn't affect any existing custom fields
1 parent 2074481 commit f96a1c2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

invenio_app_rdm/records_ui/views/deposits.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,8 @@ def load_custom_fields():
330330
# for each custom field. This is the label shown at the top of the upload
331331
# form
332332
field_error_label = field.get("props", {}).get("label")
333+
# Add the field ID to the props to allow overriding the React widgets of custom fields
334+
field["props"]["id"] = field["field"]
333335
if field_error_label:
334336
error_labels[f"custom_fields.{field['field']}"] = field_error_label
335337
if getattr(field_instance, "relation_cls", None):

0 commit comments

Comments
 (0)