Single asset/media/image type

I was looking for a way how to limit assets just to one item (other than setting max items to 1) and stumbled upon this topic: [IMPLEMENTED] Filter on content id => startswith.

I know this is not a “must have” feature, but it would be a really nice improvements in both UI and API when working with fields that will always have only one item in them. :wink:

Other than that thanks for a great cms.

I don’t understand what you mean. We have discussed so many things in this other topic.

oh, sorry I posted a wrong link. I was refering to this post: [IMPLEMENTED] Filter on content id => startswith

In general: Field type that is just a single asset.

Okay, what UI improvements would you expect? We can improve the current UI as well and disable or hide buttons when the criteria is already met.

My proposal is to start with field validation - add a checkbox “Allow multiple items”. And only if multiple items are allowed, it should be possible to allow duplicate items and set the min-max limit.
I made a mock-up for a reference field as the single/multiple problem is the same there as it is for assets.
image
image

The second part is the form itself - now it looks like this:


I think it would be sufficient to hide the “Click here to link content items” or “Drop files or click” if the field is set to contain a single item only and an item has been already selected:

And it would reapar only if you remove the currently selected item:

Third improvement would be to disable the multi-selection if the field is set to single item only:


And for assets - clicking on another asset after one has been selected would just change the selection to the second asset.

1 Like

For references you can also use the dropdown editor.

oh thanks, I’ve totally missed that.

1 Like

The newest master version also includes a tag editor for references which will look similar to this: