Paragraphs summary formatter library is added unconditionally even if the paragraph has no content

Created on 1 June 2023, about 1 year ago
Updated 28 January 2024, 5 months ago

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.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡·Greece iro

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024