Core Layout Builder Compatibility - AJAX Error

Created on 9 November 2021, over 2 years ago
Updated 1 May 2023, about 1 year ago

Problem/Motivation

Using this patch, https://www.drupal.org/project/drupal/issues/2916876#comment-14279293 ✨ Add visibility control conditions to blocks within Layout Builder Needs work , conditions can be added to Layout Builder blocks. When this module's form is rendered in Layout Builder rather than the block visibility form it fails with console error, "Failed to load resource: the server responded with a status of 500," trying to get "/layout_builder/visibility/block/overrides/node.100001/0/c358233a-6944-4402-8967-12476549051d?region=second&destination=/node/100001/layout&_wrapper_format=drupal_dialog.off_canvas&ajax_form=1&_wrapper_format=drupal_ajax"

Watchdog says, "RuntimeException: The subform and parent form must contain the #parents property, which must be an array. Try calling this method from a #process callback instead."

Steps to reproduce

Patch core with the above patch
Enable this module and Layout Builder
Add a block to a Layout Builder layout (won't work with existing blocks)
Click "Control Visibility" in the Contextual links
Choose "Content Field" and click "Add Condition"
Choose a Bundle

Result is the console error mentioned above.

Proposed resolution

I haven't found another condition plugin that uses AJAX to populate a second field, so not sure it's even possible. The condition plugins in core load all the options from the outset, so there are no examples there, either.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada darkodev

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.

Production build 0.69.0 2024