diff --git a/application/asset/js/resource-form.js b/application/asset/js/resource-form.js index a1270671a..2d361c1e4 100644 --- a/application/asset/js/resource-form.js +++ b/application/asset/js/resource-form.js @@ -427,7 +427,7 @@ const propertyValue = $(this); if (propertyValue.val()) { const propertyId = propertyValue.data('propertyId'); - const type = propertyValue.data('type'); + const type = propertyValue.data('type') ?? 'literal'; if (!itemData.hasOwnProperty(propertyId)) { itemData[propertyId] = []; } diff --git a/application/src/Form/ItemStubForm.php b/application/src/Form/ItemStubForm.php index 82c257519..a285f62e4 100644 --- a/application/src/Form/ItemStubForm.php +++ b/application/src/Form/ItemStubForm.php @@ -86,7 +86,6 @@ public function init() 'attributes' => [ 'id' => 'item-stub-title', 'data-property-id' => $property->id(), - 'data-type' => 'literal', 'data-property-id-default' => $property->id(), 'data-property-label-default' => $translate('Title'), ], @@ -105,7 +104,6 @@ public function init() 'attributes' => [ 'id' => 'item-stub-description', 'data-property-id' => $property->id(), - 'data-type' => 'literal', 'data-property-id-default' => $property->id(), 'data-property-label-default' => $translate('Description'), ], @@ -120,7 +118,10 @@ public function init() ], ]); - // Allow modules to modify this form. + // Allow modules to modify this form. Modules may add value elements by + // adding a "data-property-id" attribute to the element, set to the + // property ID. They may also add a "data-type" attribute to the element + // to set a data type that is not "literal". $addEvent = new Event('form.add_elements', $this); $this->getEventManager()->triggerEvent($addEvent);