Adding metadata values through asset builder
Summary
This document proposes a way that the asset builder can be extended in order to make it possible to specify values for metadata fields when creating an asset on the frontend.
Status: Draft
Key: draft -> approved proposal -> scheduled -> in development -> in testing -> complete -> released
Estimated Start Date: Thu, 26 Oct 2006
Estimated End Date: Thu, 26 Oct 2006
Planned Release Version: 3.12.x
Problem Definition
In many implementation scenarios, the metadata system is used to store additional data against assets. Simple-edit layouts allow these metadata values to be viewed and edited on the same screen as an asset's attributes when editing the asset in simple edit mode. However it is currently impossible to supply data for these metadata fields when creating an asset on the frontend, since only the fixed 'create' screen of the asset can be displayed by the asset builder.
Technical Specification
In order to enable the Asset Builder to apply metadata schemas to newly-created assets and populate their field values, the following development tasks will be undertaken:
- An additional field titled 'Metadata Schemas to Apply' will be added to the details screen of the Asset Builder asset type. This field will allow the user to specify one or more Metadata Schema assets, and these assets will be notice-linked to the Asset Builder asset with link value 'schema-to-apply'. The existing Asset_Edit_Fns::paintNoticeLinkedAsset() function may be enhanced and used to support this interface.
- The code in Asset Builder that replaces the %create_form% keyword will be modified so as to precede the create screen of each create type with the interfaces of the selected metadata schemas, with appropriate headings and labels. (The metadata fields will precede the normal fields because otherwise they would appear beneath the Commit button, which would be misleading for the user).
- Asset_Builder::_processGlobalActions() will be modified so that after the new asset has been successfully created, the selected metadata schemas are applied to it, and the values for those schemas' fields for that asset are set according to the values submitted in the form.
A substantial limitation of the result of the development above will be that the ordering and layout of the metadata fields and the fields from the standard create forms cannot be adjusted. Therefore the following development work will be completed in order to allow for the rearrangement of the fields:
- A field will be added to the Asset Builder's details screen titled "Create Form Customisation". Inside this field, each asset type that can be created is listed with a checkbox next to each. If the checkbox is ticked, a new Layout asset is created underneath the Asset Builder, marked (in the link value) as being relevant to that asset type.
- The code in Asset Builder that generates the replacement for the %create_form% keyword will be modified so that it checks if there is a Layout present for each of the create types. If a relevant Layout is present, it is used to generate the create form for that asset type. Otherwise the default layout (described above) is used. Inside each Layout, keywords representing fields from the asset type's details screen, and keywords representing fields from the selected metadata schemas, may be used. Layout-handling code from Asset_Edit_Interface class will be refactored to also handle the painting of the Layout in this context.