Integrate Paragraphs Browser for component adding

Created on 19 September 2022, about 2 years ago
Updated 3 August 2023, over 1 year ago

Problem/Motivation

The UI/UX of the component selection isn't the best. Especially if when compared with what paragraphs_browser made possible for paragraphs.

Having the icons is nice and all, but having screenshots, groups and some description of the paragraph-type is way better.

Proposed resolution

Somehow integrate the paragraphs_browser-UI into this module. I'm not 100% sure how, where and when this should happen, but I (kinda) got it working hard-coding some stuff in \Drupal\layout_paragraphs\Controller\ChooseComponentController::list.

I got the paragraph browser in all its glory (but the modal window is still just 300px wide... didn't look for that yet).
I can add paragraphs and it seems to work just fine (I "just" had to replace the add-buttons with add-links...)

Remaining tasks

I just have a proof-of-concept with my "work", which I'll commit into the issue-branch.
What we probably want is:
1. A way to select the selection-UI. Maybe as an option for the field-widget?
2. Posibility to select the browser (I hardcoded 'content', but that just me.)
3. Take the "availableCompontents" into account properly. I did try this, but end up with empty paragraph-groups... We need to solve that.
4. Have the window be wider. 300px ain't enough.

User interface changes

1. Field-Widget:
1.1 Select UI (Default, Paragraph Browser (only if enabled, obviously))
1.2 If Paragraphs Browser is selected, have a selection for the Browser-Type.

API changes

We probably need a way to alter the results of "ChooserComponentController::list" or use something else entirely. I didn't dig into the code enough to have any meaningful input for that.

When we have that, the whole issue might be done by another module and not even be part of the layout_paragraphs module anymore. But as it is right now, no Module can change the components-list (as far as I could find).

Feature request
Status

Active

Version

2.0

Component

User interface

Created by

🇩🇪Germany SerkanB

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany SerkanB

    So anyone who is looking for this, I've turned my first working state into a module : https://www.drupal.org/project/lpb/

    It's still not 100% ready, hence the dev-release, but it works... basically.

    Right now it's overriding the route to use a new Controller... but I would like to implement the whole thing as a seperate Widget for the layout_paragraphs-field, that somehow keeps the layout-functionality intact.

    Issues and Patches are of course welcome :D And once we have the browser running, maybe we can integrate the browser_previewer in that module... maybe.

Production build 0.71.5 2024