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.

Issue fork paragraphs-3364116

Command icon 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

iro created an issue. See original summary.

iro’s picture

Status: Active » Needs review
ricardoamaro’s picture

Testing this patch as community member

ricardoamaro’s picture

This patch seems to be working as intended.

ricardoamaro’s picture

Status: Needs review » Reviewed & tested by the community

Berdir made their first commit to this issue’s fork.

  • Berdir committed 5ff2b982 on 8.x-1.x authored by iro
    Issue #3364116: Paragraphs summary formatter library is added...
berdir’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.