Is there a way to add additional fields on each assets, from edit asset view, not in collection or singleton ?
It would be great to not have to créate a new collection only for add informations to asset.
[edit] I found this response who explain how to add some new meta field to global assets.
Do you mean global available asset metadata? Then:
Copy the file cp-assets.tag (source ) into /config/tags and modfiy it.
If you copy and paste some sample code:
you can add your custom fields.
<div class="uk-form-row">
<label class="uk-text-small uk-text-bold">{ App.i18n.get('Orientation') }</label>
<input class="uk-width-1-1" type="text" bind="asset.orientation">
</div>
Elseif you want to add a more meta data to the gallery field, you can add more meta fields in the field options…
Now I need to link this asset to a collection. How can I write this?
<div class="uk-form-row">
<label class="uk-text-small uk-text-bold">{ App.i18n.get('Category') }</label>
...
</div>
<div class="uk-form-row">
<label class="uk-text-small uk-text-bold">{ App.i18n.get('Category') }</label>
<field-collectionlink link="pages" display="title" multiple="true" bind="asset.category"></field-collectionlink>
</div>
You can pass the options as html attributes, so link="pages"
is your linked collection. bind="asset.category"
means, that the data is available as $asset['category']
.
If you want to get rid of the line, that goes outside the field, you have to remove the class uk-panel-space
from the parent container:
The screenshot is in German, but it should be self-explanatory.
2 Likes
Thanks it’s working as expected