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.]

CommentFileSizeAuthor
fix-contextual-links.patch643 bytesjhodgdon

Comments

awolfey’s picture

This is working for me. I applied the patch manually though.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for testing. Let's set the status to RTBC and see what happens with the Panels maintainers.

japerry’s picture

Status: Reviewed & tested by the community » Fixed

Good catch. Committed.

  • japerry committed d75fc12 on 7.x-1.x authored by jhodgdon
    Issue #2506615 by jhodgdon: Contextual links still not showing for...

Status: Fixed » Closed (fixed)

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