Problem/Motivation
Since the library is added unconditionally the corresponding css file is loaded even when there is no need for it.
Furthermore I stepped into another side effect. When using an entity reference paragraph field in a field group and the field group is empty, the field group gets rendered even when the option "Display element also when empty" is disabled. That happens because of the attached library.
Steps to reproduce
1. Download and enable paragraphs and field_group module.
2. Create a paragraph entity.
3. Create a node entity and add an entity reference field to the paragraph entity created in step 2.
4. Add the field created in step 3 into a details fieldgroup with "Display element also when empty" setting disabled.
5. Create content for the new entity without content for the paragraph.
- You will see the field group label rendered without content.
Proposed resolution
In ParagraphsSummaryFormatter.php add a check if $elements has value before attaching the library.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | screenshot-2023-10-17_00:55:34.png | 31.47 KB | ricardoamaro |
| #5 | screenshot-2023-10-17_00:55:10.png | 39.32 KB | ricardoamaro |
Issue fork paragraphs-3364116
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
iro commentedComment #4
ricardoamaro commentedTesting this patch as community member
Comment #5
ricardoamaro commentedThis patch seems to be working as intended.
Comment #6
ricardoamaro commentedComment #9
berdirThanks, merged.