Closed (fixed)
Project:
Field Inheritance
Version:
3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Jan 2025 at 11:08 UTC
Updated:
24 Jun 2025 at 07:49 UTC
Jump to comment: Most recent
Currently the State API is used to store the relationship between an entity and the parent entity it is inheriting from. The State API is not a permanent data store and is environment specific, so these relations are lost when moving data between environments.
We should instead use a permanent data store. Maybe a good candidate would be to store the relationship in a base field that is altered in on the child entity?
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
plopescI like this approach, and the idea of having a field where the information is stored tied to the entity instead of a separated storage.
I don't see the point of the environment specific storage, as we should consider the relationship between the entities as content, which is not intended to be shared across environments. Or are you talking about scenarios where modules like default_content are in place?
Moving into this would definitely solve #3526200: Field Inheritance data is not removed from the database when the entities are deleted nor the module uninstalled and would give other benefits, like using a widget instead of a form alter to handle the inheritance form.
On the other hand, it could be a big BC change for modules and projects depending heavily on this module, like Recurring Events.
I will try to take a look into this for 3.0.0. If I see this is not possible in the timeframe I have to work on this module, I would postpone this one for a future 4.x branch.
Thank you for your proposal!
Comment #4
plopescCreated an initial MR that more or less work:
Features implemented:
Todos:
Notes:
Comment #5
plopescMR is ready for review. It includes the upgrade path from the old DB structure based on the keyvalue storage to the new entity based approach.
All the @todos mentioned in #4 have been addressed in the MR
Comment #6
owenbush commentedI have an existing recurring events site with the default inheritances (title/description) and additional inheritances (a media entity reference from the event series) and updated to this branch and ran the database updates. Everything worked as expected.
I tested the base field and ensured that skipping inheritances on a per-entity basis worked and it was all fine.
Very nice work.
Comment #8
plopescMR merged.
Thank you all for your help here!
Comment #9
pfrenssenYay! Thanks very much!