Allow modification of allowed Collection Item types for a Collection

Created on 3 October 2023, about 1 year ago

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.

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jeffam

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024