Problem/Motivation

Views-based tabs loaded via AJAX are missing contextual links (the "edit view" pencil). The initial/default tab renders them correctly because its View render array passes through the normal render pipeline where contextual_preprocess() picks up #contextual_links.

AJAX-loaded tabs don't get contextual links because ViewContent::doRender() eagerly renders the View with renderRoot() and returns #markup. By the time the render array reaches the template layer, it's flat HTML and contextual_preprocess() never sees the #contextual_links.

Steps to reproduce

  1. Create a QuickTabs instance with AJAX enabled and multiple Views tabs.
  2. View the page as a user with "access contextual links" permission.
  3. The default tab shows the contextual links pencil.
  4. Click a secondary tab. No contextual links appear.

Proposed resolution

Add #contextual_links to the View's render array inside ViewContent::doRender(), after $view->buildRenderable() but before the renderRoot() call. This way they're part of the render array when it gets processed and survive the eager rendering on the AJAX path.

Issue fork quicktabs-3606793

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

loze created an issue. See original summary.

loze’s picture

Issue summary: View changes
loze’s picture

Issue summary: View changes

loze changed the visibility of the branch 3606793-views-tabs-missing to hidden.

loze changed the visibility of the branch 3606793-views-tabs-missing to active.

loze’s picture

Status: Active » Needs review
joelpittet’s picture

Oh I totally want this too, thanks for taking this on love!

loze’s picture

I've updated the MR and addressed your points.

joelpittet’s picture

Status: Needs review » Fixed
StatusFileSize
new20.68 KB
new48.13 KB

Thanks again @loze
Here's the manual test screenshots I did before merging.

Before:

After:

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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