- π³πΏNew Zealand John Pitcairn
I don't think this still occurs. Closing as outdated.
When editing a node using Layout Builder, adding a view block of a view display that has contextual arguments causes an AJAX error and a PHP error in Recent log messages.
Create a view with a block display of node content where the content type you are filtering the view by has an Entity Reference field to a taxonomy vocabulary. Add a contextual filter of "Content: Has taxonomy term ID". Configure it like this (selecting the vocabulary your field references):
Save the view.
Go to a node with Layout Builder enabled. Add this view block through Layout Builder.
Click "Add Block". This will cause an AJAX error to be logged to your browser console:
The form will not visibly submit and the modal window will remain open.
Close the modal window and click "Save Layout". You will see that the block has actually been added successfully and it does appear.
Edit the Layout again. Attempt to add an unrelated block. This will fail with another AJAX error.
Essentially, so long as the view block with the contextual filter exists within Layout Builder, most actions within Layout Builder will fail with AJAX errors.
Check your Recent log messages at /admin/reports/dblog.
You will see this log with severity of Error:
Drupal\Core\Database\InvalidQueryException: Query condition 'taxonomy_term_field_data.name IN ()' cannot be empty. in Drupal\Core\Database\Query\Condition->condition() (line 105 of /app/web/core/lib/Drupal/Core/Database/Query/Condition.php).
Try rendering this same view display block using the classic block layout UI at /admin/structure/block/.
It will not cause an AJAX or PHP error to be logged. It will render successfully.
Layout Builder should render a view block with a contextual filter without error, the same as if it were placed and rendered via the classic block UI at /admin/structure/block/.
Layout Builder should respect the normal process of resolving a contextual filter argument when in Layout edit mode.
In this example, when no contextual filter argument is provided (because Layout Builder gives no field to provide one), the view should default to displaying all content. This is what the view display does when previewing from the views edit form, when placing the view block from /admin/structure/block, when rendering the view block using Twig Tweak, and even when viewing the node the view block has been placed on via Layout Builder. It is only when editing the node Layout using Layout Builder that errors arise.
I'm wondering if this is at all related to: https://www.drupal.org/project/drupal/issues/2921626 β
Closed: outdated
11.0 π₯
Last updated
Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I don't think this still occurs. Closing as outdated.