Make webform blocks (block.webform.block:*) fully validatable so they can be used in Experience Builder

Created on 26 May 2025, about 2 months ago

Problem/Motivation

Experience Builder requires block configuration to be fully validatable to be included as a component in its tree. This is what the Component Status debugger tells us about webform blocks:

Similar issues include 📌 Make menu blocks (block.settings.system_menu_block:*) fully validatable Active and more to find via the related tags.

Steps to reproduce

N/A

Proposed resolution

Make webform block config fully validatable. Verify with config inspector and the Component Status validator in XB.

Remaining tasks

User interface changes

None.

Introduced terminology

None.

API changes

None.

Data model changes

TBD

Release notes snippet

TBD

📌 Task
Status

Active

Version

6.3

Component

Code

Created by

🇭🇺Hungary Gábor Hojtsy Hungary

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

Merge Requests

Comments & Activities

  • Issue created by @Gábor Hojtsy
  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Added steps to reproduce with screenshot from config inspector and guidance on where to find compatibility checking in XB.

  • First commit to issue fork.
  • Merge request !632Add machine name constraints → (Merged) created by mandclu
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    Looked a bit at this with Gábor.

    This will be the first step to make Webforms XB compatible, but not enough. I'd suggest we keep the scope here to make it FullyValidatable.

    The bad news, as this uses a yaml blob in its config, a custom xb transform will be needed for the widget.
    The good news, parts of this aparently was done already in WebformTranslationConfigManager for compatibility with config translations form integration.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 7426s
    #506888
  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Thanks for looking into this! Tested the MR. The webform block I created is almost validatable now :) The provider and webform block ID seems to have errors still in config inspector:

    I don't know if this block has all the keys that webform blocks have all the time, but if it does, then solving these two would solve it for all webform blocks :)

    I also looked at the component list in XB and it still says that it is not validateable indeed.

  • Pipeline finished with Failed
    about 2 months ago
    Total: 413s
    #507509
  • 🇨🇦Canada mandclu

    @penyaskito could you point me in the direction of a custom xb transform that has already been implemented?

  • Pipeline finished with Failed
    about 2 months ago
    Total: 505s
    #507705
  • Pipeline finished with Success
    21 days ago
    #529402
  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Expanding the scope a bit, since this could be about the initial working version of it which seems to not be too far off.

  • Pipeline finished with Failed
    19 days ago
    Total: 486s
    #531354
  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Let's keep the scope of showing up as dynamic component which is already achieved :)

  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Fails are unrelated to this MR, so moving to Needs review. I think it fulfills what it was meant to do. Webform maintainer decision is needed as to whether the block dropdown makes sense compared to the autocomplete. I think its a better user experience, but could indeed get unwieldy if someone has a loooooooot of forms.

  • 🇺🇸United States jrockowitz Brooklyn, NY

    I think if there are over 100+ webforms using an autocomplete is a better UI/UX. Perhaps we should address that decision in a new ticket.

  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Makes sense. Ideally it would not even be needed if the autocomplete would properly hold the value in XB. Rolled that part back in interest of moving this forward :) I think the block validatability changes are noncontroversial :)

  • Pipeline finished with Failed
    7 days ago
    Total: 939s
    #541071
  • Pipeline finished with Skipped
    7 days ago
    #541100
  • Pipeline finished with Skipped
    7 days ago
    #541101
  • Pipeline finished with Skipped
    7 days ago
    #541102
  • Pipeline finished with Skipped
    7 days ago
    #541103
  • 🇺🇸United States jrockowitz Brooklyn, NY

    Looks good.

  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Made diff permanent for composer patching until a release of webform includes the fix.

  • 🇺🇸United States phenaproxima Massachusetts

    I don't think this is entirely correct...you also need to explicitly mark the data structure as fully validatable by adding:

    constraints:
      FullyValidatable: ~
    

    Or, as far as I know, XB won't recognize it.

  • Merge request !654Actually mark it fully validatable → (Merged) created by phenaproxima
  • 🇺🇸United States phenaproxima Massachusetts

    Opened a second MR with the required fix.

    For details, see the change record that introduced FullyValidatable in core: https://www.drupal.org/node/3404425

  • Pipeline finished with Failed
    4 days ago
    Total: 676s
    #544631
  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Isn't FullyValidatable deduced from the data structure being fully validatable? We would only need to specify it if we want to work around parts of the data structure not being validatable and we want to force it?

    While XB does tell us the webform block config is not validatable, it does not tell us why. If you place a webform block and check it with config inspector, nothing under its setting is impossible to validate. (The top level of webform's settings says validatable).

    In @wim.leers words:

    XB doesn’t use Block config entities
    It uses BlockPluginInterfaces aka block plugins
    So XB stores a subset of what Block config entities store: only `

    settings:
      type: block.settings.[%parent.plugin]
    

    aka block.block.*:settings
    See \Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\BlockComponent::checkRequirements() :

    $data_definition = $this->typedConfigManager->createFromNameAndData('block.settings.' . $block->getPluginId(), $settings);
    

    But this part is already entirely validatable as proven by config inspector (see screenshot). If we need to add FullyValidatable manually to config trees that are already fully validatable, that sounds like a lot of extra things to do, and it will potentially lead to problems if new not validatable keys are introduced accidentally, which the workaround will paint over and hide.

  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Ok I was misguided. FullyValidatable does not mean what the name suggested to me it meant. That config inspector says a tree is entirely validatable does not mean it is FullyValidatable, because FullyValidatable is a strict validation opt-in flag, not a status indication of the validatability of a tree. So it is something that must be explicitly added and is not deduced. In short it means that all values are required by default under the key where it is specified and all keys of a mapping must be present.

    More at https://www.drupal.org/node/3404425

    So yeah we do need to opt in to the strictly validated for webform blocks to show up in XB, sorry for the prior confusion.

  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Based on that updated understanding I proposed an update to the XB error at 🐛 DX: Block plugin full validatability message may be misleading, add concrete next steps Needs review which just got merged. So that explains clearly that we need to add FullyValidatable after all.

  • Pipeline finished with Skipped
    3 days ago
    #545107
  • 🇺🇸United States jrockowitz Brooklyn, NY
  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Combined patch for xb-demo until later tagged version includes this.

Production build 0.71.5 2024