Score:0

How can I avoid that deleting fields from B deletes also fields in A?

cn flag

I have two content types: A and B. B has a entity reference field to A. There are some fields in B which autofill from values in A.

When any of the fields which are used to autofill are removed from B, this deletes from A as well. Also because of reusing fields, I can't change permissions to ready only.

Is there any solution for this?

in flag
it sounds like you need an intermediate entity. Maybe a Paragraph type? Also, while it is typically a good idea to re-use fields as much as possible, it sounds like your use case is one in which there is a valid use case for unique fields per entity. Also, if you could share more about your approach, what has worked and what hasn't, that would help.
Sherry K avatar
cn flag
Thanks for reply. So update on this issue is that I am using paragraph fields in content type A and resuing that in content type B. I am using entityreference autofill to populate values. I am able to disable edit/remove and add another button using hooks (to not let users delete any paragraph field item in content type B) but this option doesn't work in my case as I want to give users permission to delete an item from the list and donot edit or add a new item to the list in content type B. When node of content type B is deleted it also deletes the paragraph field items from content type A
in flag
Thanks for the additional information, Sherry. I'm sorry that I wasn't more precise in my request: if you could edit your actual question with the new information, as well as relevant code or examples, that would help users understand the nature of your question. In your case, the situation sounds rather complicated and I think that more specific details would help. I'm not asking you to share any proprietary information, but entity names like A and B are difficult to visualize; perhaps use dummy names that make it a bit easier for a potential answer to visualize the situation. Thanks!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.