Problem/Motivation

Quicktabs 4.3.0 introduces a regression when a Quicktabs block is rendered through Layout Builder.
After upgrading from Quicktabs 4.2.1 to 4.3.0, pages containing a Quicktabs block placed in Layout Builder crash with:

Error: [] operator not supported for strings in contextual_preprocess()

The issue does not occur when the same Quicktabs block is placed through the regular Drupal block placement system.

Steps to reproduce

1. Create a Quicktabs instance containing multiple Views blocks.
2. Place the Quicktabs block inside a node using Layout Builder.
3. Use Quicktabs 4.2.1: the page renders correctly.
4. Upgrade to Quicktabs 4.3.0.
5. Open the node.

Proposed resolution

Ensure that adding contextual links to Quicktabs instances does not generate an invalid render array when rendered through Layout Builder. The regression appears related to the contextual links addition introduced in #3606816.

Before this change, Quicktabs returned the renderer output directly:

$build = $renderer->render($this);

In Quicktabs 4.3.0, contextual links are added:

$build['#contextual_links']['quicktabs_instance'] = [
  'route_parameters' => ['quicktabs_instance' => $this->id()],
];

This causes Drupal's contextual preprocessing to run. When the Quicktabs block is rendered through Layout Builder, an invalid empty string value is passed as the "class" attribute, causing the fatal error in contextual_preprocess().

Issue fork quicktabs-3611339

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

xaa created an issue.

joelpittet made their first commit to this issue’s fork.

joelpittet’s picture

Ah darn, I failed to test in LB, let's fix this, thanks for reporting @xaa!