Subentity
The Subentity module allows you to create entities that are always attached to a parent entity, functioning similarly to how field collections worked in Drupal 7. You can define new subentity types and reference them from any parent entity using an entity reference field.
This module supports subentity, a kind of entity which does not exist independently, it always attaches to a parent entity.
Similar to field_collection in Drupal 7 but for Drupal 8+. Similar to paragraphs but not another paragraph_type.
To begin with, use the Drush generator:
drush generate subentity
This will create a new subentity type, the same way as drush generate content-entity but the new entity type is a subentity (it always is attached to a parent entity, so no new module is created).
You will be able to reference your subentity to any parent entity through entity_reference field type.
⚠️ Breaking changes
- Since 3.0.0-rc3, there are changes about custom subentity type twig template definitions, please see this change record
- Since 3.0.0-rc4, there are changes impacting CSS class naming for custom subentity type, please see this change record