As a follow-up to #1669756: Provide a contextual link for view panes
I am running a version of CTools that has that patch in it.
However, I am still running into the problem that is stated in the issue summary there. Namely:
If I add a "Content pane" display to a View, and then display that Content pane in Panels, that pane does not show its contextual links, although other panes on the page do. I would expect at least an "Edit view" link but it is not showing up.
I tracked this down to the patched line in views_content/plugins/views/views_content.views.inc. Where it is setting up the config for a Content pane display type, it says:
'contextual links locations' => array('panel_pane'),
it needs to say
'contextual links locations' => array('panel_pane', 'view'),
The reason is that in the Views function (in views.module) that adds contextual links, views_add_contextual_links(), for whatever reason the $location that is being passed in when a "Content pane" display is being rendered has the value 'view', not 'panel_pane'. And since this display type line was saying "Only render contextual links when this is rendered as a 'panel_pane'", the Views function decided to skip creating the contextual links. Here's the Views code, with comments added by me:
// This line checks to see if the "contextual links locations" setting from the Plugin setup is set. Here,
// it is set to array('panel_pane').
$has_links = !empty($plugin['contextual links']) && !empty($plugin['contextual links locations']);
// This line then sees if $location, which in this case is set to 'view', is in the "allowed locations" list.
// It is not.
if ($has_links && in_array($location, $plugin['contextual links locations'])) {
// Here it would find and create links for the contextual links, but it gets skipped.
}
So, we just need a little patch and this will work. [Hopefully the patch will apply. I made it from the client's Drupal site git repo and edited the a/b lines, as I was too lazy to clone the ctools repo etc. If it doesn't apply I can make a new patch, let's see.]
| Comment | File | Size | Author |
|---|---|---|---|
| fix-contextual-links.patch | 643 bytes | jhodgdon |
Comments
Comment #1
awolfey commentedThis is working for me. I applied the patch manually though.
Comment #2
jhodgdonThanks for testing. Let's set the status to RTBC and see what happens with the Panels maintainers.
Comment #3
japerryGood catch. Committed.