Use case: I want a "quicktabs" style view where each "tab" is a view result row. I'm rendering 3 nodes in the main display, and then the 3 node titles in the attachment. Then I have a bit of custom javascript that toggles the visibility of the appropriate node based on the link clicked. This requires the order of the titles in the attachment and the full node displays in the main display to match.

Setup: I have a Views Content Pane display configured in my view, which has an attachment. The attachment is configured to inherit arguments and exposed filters from the parent display. The content pane is configured so that the arguments and exposed filters / sorts can be configured via the panel pane configuration.

Situation: with the above setup, there is no exposed filters form displayed or rendered - the settings come from the panel pane. As a result, there are no $_GET parameters in the url showing what the exposed input values are.

Problem: the parent content pane display receives the exposed input values from the pane configuration, and that display appears correctly. However, the attachment doesn't receive its exposed input values from the parent display - it is still looking at the url for the $_GET parameters, even though it has the correct values in $view->exposed_input (when printed in the "attach_to()" function in plugins/views_plugin_display_attachment.inc). It doesn't have $view->exposed_raw_input or $view->exposed_data set initially, however once get_exposed_input() function is executed all of these 3 variables are set to the default values, not the actual values configured in the panel pane.

This means that the content pane and its attachment are using different exposed filters/sorts, which is causing problems with my "quicktabs" use case as there is a different sort applied to the 2 displays, and so there is a mismatch between the title clicked and node content displayed.

Solution: 2 line patch (see attached) which uses the "exposed_input" as the parent display and calls $view->set_exposed_input(). This prevents the exposed form being submitted again which would result in the default exposed filter/sort settings being used rather than those configured in the panel pane.

Comments

stella’s picture

FYI, I also tested the above patch with a more "normal" use case - i.e. a page display with an attachment, and it worked as expected.

Status: Needs review » Needs work

The last submitted patch, views_content_panes_attachment_exposed_filters.patch, failed testing.

The last submitted patch, views_content_panes_attachment_exposed_filters.patch, failed testing.

dawehner’s picture

FYI, I also tested the above patch with a more "normal" use case - i.e. a page display with an attachment, and it worked as expected.

That is great, thank you! It would be really great if someone else also has a look at (maybe this is me(marking this tab as pinned)).

stella’s picture

I think the patch is failing because I've created it the wrong way. Will try rerolling tomorrow.

stella’s picture

Status: Needs work » Needs review
StatusFileSize
new787 bytes

Finally got time to do a patch reroll :)

Status: Needs review » Needs work
stella’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
stella’s picture

Version: 7.x-3.7 » 7.x-3.x-dev
Status: Needs work » Needs review

No idea why this patch is failing, trying against latest dev

stella’s picture

jenlampton’s picture

Status: Needs review » Reviewed & tested by the community

I'm also having this problem with the latest version of Views for Drupal 7.

My content pane view has an exposed filter for "county" as does the attachment.
Both exposed filters have the filter identifier 'field_county_value'.
Using the exposed filter on pane config (for the content pane) narrows the results of the main (content pane) display, but not the attachment display.

I was able to get the exposed filters on the attachment working by doing two things.
1) unchecking the Allow settings option: Use exposed widgets form as pane configuration
2) setting the "Use panel path" setting to YES

This patch 100% solves my issue. Thanks 1000! :)

fearlsgroove’s picture

** edit ** nevermind

andrewmacpherson’s picture

Just a note to confirm that the patch from comment 6 still applies cleanly to the recent views-7.x-3.8 release.

jenlampton’s picture

*edit* just seconding the above :)

kopeboy’s picture

Can we include it in a release please?

I am not able to display attachments to Content panes from Panels.

EDIT: Actually the attachment displays only AFTER I use the exposed filter (set on the Content pane to which it is attached), but until then it returns no values.
Of course the exposed form is not input required, and I set the attachment to inherit contextual and exposed filter from the Pane (then I placed the exposed form block with Panels on the page, with Inerith path.

SOLVED: Nevermind, it was a problem with CSS (displaying a floated google map).

stella’s picture

Still applies cleanly to 7.x-3.10 release. I know you're busy (much like myself) but any chance of getting this committed soon? It's been over a year since I contributed the patch and almost a year since marked RTBC.

  • dawehner committed 0352f38 on 7.x-3.x authored by stella
    Issue #2171389 by stella: Attachments on Views Content Panes don't...
dawehner’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.x-dev » 8.0.x-dev
Component: Miscellaneous » views.module
Status: Reviewed & tested by the community » Patch (to be ported)

Seems legit.

2 years RTBC? Why is this not commited?

You know the answer, don't you?

stella’s picture

Ah sure now, it wasn't 2 years :)

Many thanks for committing it though, it's much appreciated.

blasthaus’s picture

I was getting this PHP notice on a view after upgrading to 7.x-3.11 as a result of this patch.

Notice: Undefined property: view::$exposed_input in views_plugin_display_attachment->attach_to() (line 230 of /sites/all/modules/views/plugins/views_plugin_display_attachment.inc)

It seems that if a views attachment has "inherit_exposed_filters" checked and the view to attach to has no exposed filters (like I did by mistake)
then $this->view->exposed_input is not even set, hence the notice.

<?php
//maybe like this?
$exposed_input = $this->get_option('inherit_exposed_filters') && isset($this->view->exposed_input) ? $this->view->exposed_input : array();
?>
daemonchrist’s picture

jibran’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new858 bytes
dawehner’s picture

Issue tags: +VDC, +Needs tests

The patch itself is working perfectly.

I guess we need test coverage if we fix a bug ..

mgifford’s picture

StatusFileSize
new858 bytes

Re-submitting the prior patch for the bots to review.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

csedax90’s picture

Status: Needs review » Reviewed & tested by the community

#25 is working fine

joelpittet’s picture

Status: Reviewed & tested by the community » Needs work

@sedex can you put your testing into words or better into an automated test?

Hopefully that will prevent the bug from reoccurring.

Thanks for testing the patch

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

emclaughlin’s picture

Just FYI this isn't working on 8.6 for me.

Beau Townsend’s picture

Using Drupal 8.7.8 and patch in #25 resolved the issue for me. I tested with a content type and custom entity and was able to have the Attachment inherit exposed filters from both a Page and Block parent. I was able to use a drop-down exposed filter as well as an exposed Geolocation proximity filter.

sam152’s picture

StatusFileSize
new755 bytes
new1.19 KB

I ran into this and had an additional issue: none of the views exposed filters are added as keys to the render caching integration, so the same views attachment rendered with completely different exposed filters was enough to cause incorrectly cached results.

Disabling the direct render caching integration fixed this, while allowing the block to still appear in dynamic page cache.

Still NW for tests and probably an IS update.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

kim.pepper’s picture

Issue tags: +#pnx-sprint
meenakshi_j’s picture

Status: Needs work » Needs review
StatusFileSize
new1.19 KB
new744 bytes

Fixed the issue.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +Needs Review Queue Initiative, +Needs issue summary update

This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

Wonder if this is an issue for D10? I have not seen this issue yet

If so could the IS be updated for D10 steps please
Still needs tests also.

init90’s picture

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

emerham’s picture

Yes this still an issue with Drupal 10.3

My steps are simple view

Have a node bundle with two fields:

  • Body
  • Select List Text

Create a Paged view and expose the filter of the Select list

Create an attachments view display and attach it to the paged view. Exposed the same filter from the paged view with the same identifier

Ensure the Inherit exposed filters is checked

Attempt to filter the paged view and see that the attachments view is not filtered.

If these are the steps that would let this be reproducible then I can update the issue and start working on some tests.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Needs work
Issue tags: +Bug Smash Initiative
yannickoo’s picture

Hello 👋 I am coming from #2807857: Exposed filters do not appear on attachment display and can confirm that the patch #40 has fixed the issue, thanks for that 💪

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.