Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem
It's quite hard to eliminate which paragraphs are used in the layout sections.
Proposed solution
Use a small label, e.g. in the bottom right corner to identify which paragraph type it is.
Comments
Comment #2
waluigi CreditAttribution: waluigi at Unic commentedI created a patch for this. In entity_reference_layout.module before it gets rendered, I iterate over all layout_items and simply add a label to it.
Is this the right way to go?
Comment #3
saschaeggiComment #4
saschaeggi@waluigi does this add the layout item name or the name of each paragraph?
Comment #5
waluigi CreditAttribution: waluigi at Unic commentedDespite your examples (and the title...) I misunderstood you, sorry for that.
I created a new patch that adds the label of the paragraph to the bottom right corner.
Comment #6
waluigi CreditAttribution: waluigi at Unic commentedI removed an unused variable.
Comment #7
saschaeggiPatch from #6 works like a charm for me.
Thanks @waluigi.
One thing I discussed with justin2pin if we could make this a module setting. And by default it would not be activated (Checkbox: "Show Paragraph Labels").
Comment #8
waluigi CreditAttribution: waluigi at Unic commentedI implemented the configuration form for the module and added a checkbox there, as you proposed.
By default the settings is disabled.
Comment #9
saschaeggiI've tested the patch and can confirm that it works flawlessly.
I would move the settings to
/admin/config/content/entity_reference_layout
Comment #10
waluigi CreditAttribution: waluigi at Unic commentedMoved the settings to /admin/config/content/entity_reference_layout. Thanks for the feedback.
Comment #11
waluigi CreditAttribution: waluigi at Unic commentedI added a menu link for the configuration.
Comment #12
saschaeggiWorks like a charm.
@justin2pin can we move on with this and move it into dev?
Comment #13
justin2pin CreditAttribution: justin2pin at Aten Design Group commentedCan we move this to form display settings instead of creating a separate settings form? Let me know what you think.
Comment #14
saschaeggiSounds like a good idea, @waluigi can you update the patch?
Comment #15
waluigi CreditAttribution: waluigi at Unic commentedTell me if I'm wrong but wouldn't you have to enable it for each field on its own then? Also, it's unclear for me why someone would enable this on one ERL field but not on another one.
So, from my point of view it would make more sense to leave this in the module settings.
What do you think?
Comment #16
justin2pin CreditAttribution: justin2pin at Aten Design Group commentedYes, you would have to enable the setting per-field.
I don't have too strong of an opinion on this since I haven't really seen a need for the feature yet personally, but it seems like it belongs in the form display settings because it directly pertains to the way the field is rendered on edit forms. Also I can imagine this being useful one way for more complex content types with more paragraph types available, and another way for simpler ones.
Comment #17
saschaeggiwhen I did wrote my last comment "sounds like a good idea" I wasn't thinking of the case that a sitebuilder would need to set it on each field. As the case of projects with a lot of different erl fields I would prefer it to have it as a global setting.
So @justin2pin can we move the change from #11 into dev?
Comment #18
saschaeggiComment #20
justin2pin CreditAttribution: justin2pin at Aten Design Group commentedCommitted and pushed. Thanks y'all!