HI All,

Entity reference field retrieve only for content title only, but i need other fields also dependent to retrive their values in one content type to another content type.

Content type A get values for textbox
Content type B retrive the values for dropdown. This function is only for i needed in drupal 8.Can anyone suggest me.

Comments

peter.cardillo’s picture

I have a "hero slider" entity containing an entity reference to a "background color" entity (fields: Color = "blue", or "black"... and Color-class = "bg-blue", "bg-black"...). Users can select the Color from the drop-down select box, but the Color-class (field) needs to be embedded in HTML (ie. class="{{ background-color.Color-class }}").

I found this example which describes how to chain entity bundles together via the Rules UI, but that seemed overly complex.

I tried creating a view that displays the entity-referenced "background color" field as a "Rendered entity" (formatter) using the "Full content" (view mode). This outputs both fields (Color & Color-class) as plain text, so now I'm trying to figure out if I can override that via hooks and/or a custom twig template. I'll update this thread with my findings.

peter.cardillo’s picture

Hi pandiarajan,

The Entity Browser module might be helpful, but it may be overkill if you simply want to display a dropdown box (within Content type B) containing values from one of Content type A's other fields.

VM’s picture

per https://www.drupal.org/node/643758 please edit your post and move it to the 'post installation' forum. Thank you.