Hi!

I'm trying to create an entity reference field for a certain paragraph type to give my editors the possibility to reference to an existing paragraph within another paragraph.

First try (my Drupal is not in English - so I can only guess the original English terms):

  1. Create paragraph type named "Reference Test"
  2. Add new field of type "Reference" - "Other..." -> Item type "Paragraph"
  3. Reference method: "Default"; select the desired paragraph type.
  4. Manage form display: Select list
  5. Manage display: Format as rendered entity

Now, if I add a paragraph of type "Reference Test", I see the select list, but the LABELS are empty! So it's kind of an empty select list. The HTML code shows the paragraph IDs as select item keys (so that's fine), but I do not see any label. I've added an attachment... Like that, it's very uncomfortable to select the proper paragraph.

Second try:
1b. Create an entity reference view as described in this tutorial: https://www.ostraining.com/blog/drupal/entity-reference-view/
2b. Add the title field of the paragraph as a field to the view (this should be the label!)
3b. Change the reference field (step 2 of first try) and choose the view instead of the default reference method.

Unfortunately, I get the same result as with my first try...

How can I select one or more paragraph fields to show up as labels in my select list?

Any help is appreciated! Thanks! :-)

CommentFileSizeAuthor
printscreen_empty_select_labels.png12.62 KBmichèle

Comments

Michèle created an issue. See original summary.

michèle’s picture

Issue summary: View changes
johnchque’s picture

Status: Active » Fixed

Hi @Michèle, the procedure you wrote about adding a reference field inside a paragraph for referencing paragraphs is fine BUT step 2 is sightly wrong, you should use a "reference_revisions" field instead of just "reference" field. You can find a good example in Paragraphs_demo module, paragraph type: Nested Paragraphs.

michèle’s picture

Hi yongt9412

Many thanks for your answer! Unfortunately I did not get it so far... :-( I understand your suggestion and tested it and looked at the example in the paragraphs demo module, but without success. If I create a reference revisions field instead of a reference field, I only get the possibility to create NEW paragraphs. But I want to REFERENCE to an existing paragraph of a certain type.

So, let's say I have a paragraph type which holds the fields for an image gallery (two fields: 1 title and unlimited images). On a page called "Galleries", I insert multiple of these gallery-paragraph types. That works fine!
Now, on another page, I want to include one of these galleries (I want to reuse it instead of creating the same gallery twice).
For this purpose, I create another paragraph type called "Gallery Reference". This paragraph type should only contain of one field which stores the reference to the desired gallery.
That's why I created a reference field like I would do for i.e. blocks. The resulting select list is correctly filled with the keys of all gallery-paragraphs, but the values with the matching gallery titles remains empty.

I'm not sure if I did not understand your solution or if my issue description was missleading...?

Thank you very much!

michèle’s picture

Status: Fixed » Active
jeroen.b’s picture

Status: Active » Closed (works as designed)

Hi @Michèle,

That's not the purpose of Paragraphs. Created Paragraphs are bound to their host entity.
If you want to create re-usable blocks and use them in Paragraphs I think the best way is to create a Paragraph Type "Gallery" that contains an entity reference field to some other entity containing the actual Gallery.

michèle’s picture

Thanks for the clarification, Jeroen.