Imagine that we want to allow a collection_item type for a single Collection, rather than all Collections of that type. Or for any Collection of any type that has a specific field value set.

We already have hook_collection_item_types_allowed_alter() which can alter the collection_item types returned from CollectionType::getAllowedCollectionItemTypes(). Both the hook and method can accept an optional $entity_type_id parameter and $bundle parameter.

We should add a $collection parameter to allow hook_collection_item_types_allowed_alter() allow modification of the allowed collection_item types based on some property of a Collection in contexts where that might matter.

A use case might be that we have more than one collection item type for a given entity type and bundle (e.g. node.article).

In one context, we might want to use the `default` collection item type to join an article node to a collection, but for one specific Collection we might want to use, say, the `tagged_item` collection item type.

Comments

jeffam created an issue.

  • jeffam committed aed8a38e on 3391439-allowed-items
    Issue #3391439 by jeffam, a-fro: Allow modification of allowed...