0

I have two content types, Content A and Content B, which both have a field_code field.

Content A has an entity reference type field (field_content) whose settings are reference type (Content) and vontent type (content_b).

I want to populate Content A's field_content with Content B's field_content when Content A and Content B's field_code have an exact match.

I can do this in the UI by searching for field_code which is part of Content B's title.

As I have more than 500 content items to do I would like to do this automatically, I have looked at doing is via a custom module, node_presave, migrate yaml files and a preprocess function in my custom theme.

Note: Content B has been generate by a migrate YAML file.

1
  • node_presave() can do this in a custom module. Write the code to do the update and then just re-save all the content and it should be updated correctly. Commented Nov 29 at 8:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.