Issue:
We need, for each asset to be able to edit the ‘alt’ text. The ‘alt’ text must be used on the site each time an asset is displayed.
When displaying an asset, the mechanism is the following :
- Get the Locale from the request
- When getting the asset, get the associated Alt property corresponding to the locale.
- Populate the alt attribute with this value.
Resolution:
To achieve this, we can customize the DAM Asset Editor.
The AssetEditor is the form used to input asset properties and metadata.
Below is a screenshot of a customized form with four “alt” input (for four different locales).
The DAM uses the following nodes to render Asset Editor forms:
- /libs/dam/content/asseteditors/formitems
- /libs/dam/content/asseteditors/images/formitems
- /libs/dam/content/asseteditors/images/jpeg/formitems
- /libs/dam/content/asseteditors/image/tiff/formitems
We must not modify these files as it is source files for CQ.
But we can copy the /libs/dam/content/asseteditors node (and it’s child nodes) to /apps/dam/content/asseteditors to customize the form.
In this case, several nodes were added with the following specs:
• Label : Alt (or Alt Fr, Fr,…)
• jcr:PrimaryType: cq:Widget
• name: ./dc:alt (or ./dc:altDe…)
• xtype: textfield
etc,etc…..
Below is a representation of the new asseteditors/formitems tree:
Once the form is persisted, the new metadata are stored under the following node :
/content/dam/{imagepath}/jcr:content/metadata
where now, the metadata node contains the following properties:
Nhận xét
Đăng nhận xét