Paragraphs Behaviours have become a solid tool in Paragraphs managements and configurations.
They are supported in the but not in the "Paragraphs EXPERIMENTAL" ("paragraphs") widget,
but not in the "Paragraphs Classic" ("entity_reference_paragraphs") widget, from which the actual "Entity reference layout (With layout builder)" started extending since its beginning ...

The Paragraphs Behaviours supporting part of the "Paragraphs EXPERIMENTAL" ("paragraphs") widget should be added in the "Entity reference layout (With layout builder)") widget ...

Comments

itamair created an issue. See original summary.

justin2pin’s picture

Status: Active » Needs review
StatusFileSize
new7.39 KB

This patch adds behavior forms to each applicable paragraph dialog within a "Behaviors" detail form item.

itamair’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new10.56 KB
new5.42 KB

Thanks @Justin that is great, and is working great. But from my Review I faced a use case in which a better handling is needed when there is a Paragraph Behaviour enabled for the specific Paragraph Type but that doesn't a specific configuration form (buildBehaviorForm method).
It might happen ... (check your new "paragraphs_layout" behaviour). In that case Behaviours accordion won't show any reference to init and will appear empty in case this is the only Behaviour enabled for the Paragraph Type ...

The attached patch fixes all that, both in the Behaviours form definition (adding a mention to the Behaviour with no specific configurations settings, and with the link to the Paragraph entity type settings page (@see attached screenshot) and in the Submission validation (we need that otherwise an error will be thrown on the $plugin_form validation.

Besides it, the patch also fixes some coding standards and methods @return statements.

RTBC

justin2pin’s picture

StatusFileSize
new10.01 KB
new3.8 KB

Let's hide the behaviors subforms entirely when there is nothing to render. Patch attached.

justin2pin’s picture

StatusFileSize
new10.68 KB
new2.11 KB

One more minor change to make sure the behavior form is actually hidden when there are no options to show.

itamair’s picture

Status: Reviewed & tested by the community » Needs work

Justin, your last patch seems removing the publish/un-publish support:

@@ -537,7 +539,6 @@ class EntityReferenceLayoutWidget extends WidgetBase implements ContainerFactory
       '#attributes' => [
         'class' => [
           'erl-item',
-          'erl-item--' . ($entity->isPublished() ? 'published' : 'unpublished'),
         ],
         'id' => [
           $this->fieldName . '--item-' . $delta,
justin2pin’s picture

Status: Needs work » Needs review
StatusFileSize
new10.07 KB
new926 bytes

Geez, too many projects open. Thanks for the catch -- re-roll and inter-diff attached.

itamair’s picture

Status: Needs review » Reviewed & tested by the community

#7 works fine. Green flag for commit ;-)

  • justin2pin authored bcfd322 on 8.x-1.x
    Issue #3128137 by justin2pin, itamair: ERL widget should support...
justin2pin’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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