Entity field value inherited from another entity programmatically? I'd like to setup two content types in a parent -> child relationship.

Node A of content type "parent" has custom field:


(text) Description


Node B of content type "child" has custom fields:


(text) Description dynamically inherited (referenced) from parent node.
(reference) to parent node


When the description of Node A changes, Node B automatically reflects this change.

I'd like to achieve this entirely on the backend, no UI or forms needed.

I will be creating the child nodes programmatically.

Topics I've found have danced around what I'm trying to do but lack the details I need to execute it.
inheriting fields from a base content type

I have experience with Drupal 6 &amp; 7 but am new to Drupal 8's entity apis.

A detailed explanation or example of how to achieve this would be greatly appreciated.

Thanks

One possible solution:

Store the parent node's updated date in the child node.
Upon loading the child node, lookup the parent node's updated date, if it differs, copy the parent's field value to the child.

The parent node will not be updated frequently.
The way I would tackle this is to create a new field type called “parent_value”.Design it in such a way that it doesn’t actually store any data in the database but instead uses the existing object’s entity reference value to look up the value from the parent. This way you don’t have to rely on any sort of Dripal trigger to alter the value in the child, which will ensure that if values are updated programically, they will still match.

There is also the added advantage that creating a custom field will teach you everything you need to know about Drupal 8 plug-ins.