I am a bit confused about the behaviour of the media browser.
Here is the situation:
We have 2 collections and 2 tags
When I edit an asset (that has no tag and no collection selected yet):
I am able to select any tag and/or collection. As expected.
As soon as I select a collection and save, I cannot add tags anymore:
Even if I added tags before, they are not visible anymore as soon as I added the asset to a collection.
The only way to get the tag visible in the edit-mask is to
a) remove the asset from all collections
b) edit the collection and add the tag there:
I don’t understand why tags are not visible anymore in the edit-view of an asset when a collection is selected. Is this a bug or do I not understand the priciple of the system?
Btw, if you can still add tags to the asset via drag&drop and the filtering works. But you cannot remove the tag as this is not possible with drag&drop.
I think the reason for the behaviour is the condition used to assign the tag-variable for the view in \Neos\Media\Browser\Controller\AssetController::editAction:
public function editAction(Asset $asset)
'tags' => $asset->getAssetCollections()->count() > 0 ? $this->tagRepository->findByAssetCollections($asset->getAssetCollections()->toArray()) : $this->tagRepository->findAll(),
'asset' => $asset,
'assetCollections' => $this->assetCollectionRepository->findAll()
Any feedback would be nice, I could also help to fix/test if this is a bug.
For my understanding it works this way:
- Each collection can have its own tags.
- Created tags are only available for the selected collection in the moment of creation.
- When selecting “Sammlung 2” and adding a tag, it’s only avavible for assets in this collection. So if you are in “Sammlung 3”, the tag isn’t existing for assets in “Sammlung 3”. Edit the collection and add the tag to make it available.
- When adding a tag global (Collection “All”), it can only set to assets with no “collection”.
I can see the advantage in this logic. Imagine you have 300 Tags… that would be very hard to manage if all tags were available for an asset which is actually in a collection with only 3 Tags.
Yep it’s like @renewoerz described, collections are meant for separation of assets including tags. You can edit a collection to select which tags should be available in said collection.
Maybe the usability/UX should be rethink here. It took quite some time until i unterstood this, too.
Thank you @renewoerz and @aertmann. I will check that and re-consider our usage of collections in our Neos projects.
It could be definitely be explained as currently it’s not. However if collections didn’t behave differently than a tag, then they wouldn’t make any sense. Then you would just use tags. Also access restriction makes sense for collections, not really for tags.
Thank you for the explanation. I got it now and it makes sense.
Adding tags via drag&drop is not behaving the same I think. When I display the asset of all collections and I drag an asset to any tag (even those who are not assigned to the collections of this asset), I can add the tag to the asset. The counter of the tag is increased.
When I edit the asset afterwards, I don’t see the tag that I just assiged via drag&drop. When I save it then (without doing anything), the assigned tag is removed again. I can see that because the tag-counter is decreased again.
Maybe I get something wrong here?