Problem/Motivation

Let’s build a new form where:

  • For both slots and props, we list them first and pick source for each of them
  • We allow multiple source for slots but not for props

There are 4 form parts:

  • Component selector
  • Variants selector
  • Slots
  • Props

“Variants selector”, “Slots” and “Props” change according to the value of "Component selector”.

Form parts are “à la carte”, some “consumers” need only some parts.

Proposed resolution

See specifications: https://docs.google.com/document/d/1-GaMK1Qk-h0hmB7GtAcnqPTuCOGMaxeRguop...

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

pdureau created an issue. See original summary.

pdureau’s picture

Status: Active » Needs work

Form implementation too heavy

The form implementation was done using UI elements from paragraphs module, as it was initially discussed, but we underestimated the hevainess of the paragraphs source code.

Now 20 % of the project PHP code is found in /src/form/

Also, addition of:

  • ui_patterns.module
  • templates/
  • css/
  • icons/
  • js/
  • src/Element/DropdownAction
  • src/Element/UiPatternsOperations

The current state of specifications is taking inspiration from Image Styles admin pages and Manage Display admin pages. It may be lighter because using Drupal Core native form elements.

Update of the slots & props forms when variant is changes

This is an undocumented behaviour. I know we want to make the condition mechanism addable in UI Patterns Settings 3.x, but is there a simpler way ? Also, if we change variants, do we keep our props settings?

Context management

How to add context to Source plugins was documented and tessted. But it still not clear how to set the conetxt from the consumer plugins (layout, field formatters...).

Maybe it is not implemented yet in the form builder:

  protected function getComponentSourceContexts(): array {
    return [];
  }

Failed tests

I don't know if the issue is on the "consumer" side or the form builder side:

Layout plugin:

  • variant is not saved
  • Issues with Layout Builder: "add blocks" not in the regions, & blcok not configurable. I guess we need to add some stuff from ui_patterns_layout_builder

Block plugin:

  • "RuntimeException: The subform and parent form must contain the #parents property, which must be an array." maybe because we are using buildComponentsForm() from blockForm() instead of buildConfigurationForm()

View style plugin

  • Call to undefined method Drupal\Core\Form\FormState::getCompleteFormState() in ComponentStyle->buildOptionsForm(). Do I need to use ComponentSettingsFormBuilderTrait instead?

FieldFormatters:

  • Don't work on layout builder
  • Some sources (example: menu and breadcrumb for links) show up in layout builder but not in manage display

alterComponent

Some source plugins have alterComponent() method which is a successor of UI Patterns Settings alterElement() method.

Examples:

Do we manage them in the form builder, because we already buildComponentData() here? Or do we move this and buildComponentData() to another service?

  • pdureau committed 783be601 on 2.0.x
    Issue #3395953 by pdureau: Add first slot widget and fix slot management...

  • pdureau committed ec56dabf on 2.0.x
    Issue #3395953 by pdureau: Extract ComponentElementBuilder from Form...
pdureau’s picture

Title: [2.0.x] Add new Form Builder » [2.0.0-alpha1] Add new Form Builder
pdureau’s picture

"Form implementation too heavy" will be done in #3414363: [2.0.0-alpha1] Form builder: Simpler sources selector (1/2)

pdureau’s picture

"alterComponent" was already done in the ComponentElementBuilder

  • pdureau committed cfbb6527 on 2.0.x
    Issue #3395953 by just_like_good_vibes: ComponentElementBuilder, pick...

  • pdureau committed 371982bb on squash-form-refactor
    Issue #3395953 by Christian.wiedemann: Refactor Form Builder
    

  • pdureau committed cfbb6527 on squash-form-refactor
    Issue #3395953 by just_like_good_vibes: ComponentElementBuilder, pick...

  • pdureau committed 371982bb on 2.0.x
    Issue #3395953 by Christian.wiedemann: Refactor Form Builder
    
pdureau’s picture

Assigned: christian.wiedemann » Unassigned
Status: Needs work » Fixed

Merged. Future tasks will be done in dedicated issues.

Status: Fixed » Closed (fixed)

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

christian.wiedemann’s picture