I have a webform in Drupal 8 with an entity select element. The element is populated from an entity reference view. I have a book content type with information about the book such as title and author. I also have a field collection in book containing more specific details such as ISBN and format. The entity reference view displays title-isbn-format. For example:
Dune – 9780441013593 – Paperback
Dune – 9780143111580 – Hardcover
I applied the view entity reference patch posted here. The form correctly displays the output of the view. How do I get the same display in the form submission? If I set the form display to value and select Dune paperback the result is “MyBookFieldCollection 0 of Dune (9).”
I tried using tokens but I can only get the field collection info, not the book info.
Here is the source for the element:
book_title: '#type': entity_select '#title': 'Book Title' '#select2': true '#format': custom '#format_html': '[webform_submission:values:book_title:node:title] - [webform_submission:values:book_title:entity:field_isbn_13] - [webform_submission:values:book_title:entity:field_format]' '#format_text': '[webform_submission:values:book_title:node:title] - [webform_submission:values:book_title:entity:field_isbn_13] - [webform_submission:values:book_title:entity:field_format]' '#target_type': field_collection_item '#selection_handler': views '#selection_settings': view: view_name: entity_reference_for_form display_name: entity_reference_1 arguments: { }
This correctly displays the ISBN and book format but not the book title.