Because we generated proper Layout plugins, they must be usable with the popular https://www.drupal.org/project/layout_paragraphs module (11 000 installs )

But it is better to check

Comments

pdureau created an issue. See original summary.

pdureau’s picture

Title: [2.0.0-beta3] Test ComponentLayout with layout_paragraphs » [2.0.0-beta4] Test ComponentLayout with layout_paragraphs
pdureau’s picture

Title: [2.0.0-beta4] Test ComponentLayout with layout_paragraphs » [2.0.0-beta5] Test ComponentLayout with layout_paragraphs
g4mbini’s picture

ComponentLayout with layout_paragraphs is working off-the-shelf.

Tested with UI Suite DaisyUI as follows:

  1. Create a paragraphs called section
  2. Check the Layout Paragraphs behaviour
  3. Pick layouts from all component layouts provided by UI Patterns
  4. Save
  5. Create some classic paragraphs (without checking the Layout Paragraphs behaviour)
  6. Configure the display for each classic paragraphs
  7. Edit Basic page content type
  8. Add a Paragraphs field and check Section paragraphs and classic Paragraphs available for the field
  9. Goto Manage Form Display and choose Layout Paragraphs widget for the Paragraphs field
  10. Goto Manage Display and choose Layout Paragraphs format for the Paragraphs field
  11. Eventually create a Basic Page node
  12. Add a section Paragraphs from one of the layout chosen
  13. Inside each region you can add classic Pargraphs instance

What could be very kool in the node edit would to have CSS from front loaded inside the Paragraphs field.

There is an issue about that there : https://www.drupal.org/project/layout_paragraphs/issues/3208180

g4mbini’s picture

Assigned: g4mbini » Unassigned
Issue tags: +UI Suite Initiative
pdureau’s picture

Component: Code » Miscellaneous
pdureau’s picture

Status: Active » Fixed

So, everything is OK on our side.

Status: Fixed » Closed (fixed)

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

pdureau’s picture

fschaff’s picture

Hi,
I'm trying to create a custom layout component available in layout_paragraph.
Starting from something simple :

name: Section
description: "Section test"
group: Layouts
slots:
  col_1:
    title: Colonne 1
  col_2:
    title: Colonne 2

I can't get the attribute classes for the regions
Is there anything I can pass to the twig or configure in the yml?
Thanks

just_like_good_vibes’s picture

Hello,
you need to create props to store attributes for each section.
in the component definition, with $ref: ui-patterns://attributes

you can then use them in twig

fschaff’s picture

Thanks,
I have now this:

name: Section
description: "Section test"
group: Layouts
slots:
  col_1:
    title: Colonne 1
  col_2:
    title: Colonne 2
props:
  type: object
  properties:
    attributes:
      $ref: ui-patterns://attributes
    col_1_attributes:
      $ref: ui-patterns://attributes
    col_2_attributes:
      $ref: ui-patterns://attributes

and this:

<div{{ attributes.addClass('section') }}>
  <div{{ col_1_attributes.addClass('col_1') }}>
    {{ col_1 }}
  </div>

  <div{{ col_2_attributes.addClass('col_2') }}>
    {{ col_2 }}
  </div>
</div>

But the col_1_attributes and col_2_attributes are empty…
Do I miss something?

fschaff’s picture

If it ever helps anyone, no need to define attributes in the props, just add in the twig :

{% set SLOT_NAME_attributes = create_attribute(SLOT_NAME['#attributes'] ?? {}) %}
<div{{ SLOT_NAME_attributes }}>
      {{ SLOT_NAME }}
</div>

I don't know if this is the right method, but it works with layout_paragraphs.