Seeing as Drupal 7 has this contextual links system baked in, it seems silly for Panels not to be using it (perhaps I'm missing something here - if so, please enlighten me).

As a front-end dev it's a bit of a pain that Panels adds vertical space to a page if the logged in user has permission to edit Panels - tapping into the existing contextual links system would solve this rather nicely.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Hydra’s picture

would love to see that, too

merlinofchaos’s picture

I agree. This will happen. Interestingly this is actually a feature of CTools, not Panels, so this will need to be filed against CTools.

merlinofchaos’s picture

Project: Panels » Chaos Tool Suite (ctools)
Version: 7.x-3.x-dev » 7.x-1.x-dev
Category: feature » task
dddbbb’s picture

Yey! That's fantastic news. Can't wait to see this happen.

EndEd’s picture

Subscribe

bryancasler’s picture

subscribe

Håvard’s picture

Sub..

dawehner’s picture

Status: Active » Needs work
FileSize
1.15 KB

Here is a first version ...

Sadly i can't figure out the place where the local action is defined.

dawehner’s picture

Assigned: Unassigned » dawehner
FileSize
3.71 KB

Assign to myself.

Here is a the version... i'm kind of lost with $handler, $task, $page, $plugin etc.

dawehner’s picture

[00:26] Quick review: Can't remove ctools_context_handler_pre_render() -- it can be empty, though. But it gets called externally, removing it would break API.
[00:26] *** davereid|brb is now known as davereid.
[00:27] ah okay ... removed it on several places
[00:27] $handler and $task are the two plugins that make up the current page. $page is, if it's the context I'm thinking, just a flag saying whether or not the renderer owns the page.
[00:28] $plugin is a raw plugin definition, though need more context to tell you which one. :)
[00:28] dereine: page_manager_page_execute($subtask_id) isn't going to be a good place for that code. :/
[00:29] merlinofchaos: mh but this seems to be the only place which is called all the times
[00:29] dereine: ctools_context_handler_render_handler() is probably the right place.
[00:29] nice there everything is availible :)
[00:29] dereine: And it's not called all the time; that's only used on a custom 'page'. But it is not used on any system page, aka anything not using the 'page' task.

dawehner’s picture

Status: Needs work » Needs review
FileSize
3.38 KB

Okay here is a new version.

I'm not sure whether it should be 'Edit Panel' or 'edit panel' but based on all other instances it should be 'edit panel'.

dddbbb’s picture

Blocks and Views use "Configure block" and "Edit view" so I'd suggest "Edit panel".

merlinofchaos’s picture

We can't specify 'panel' by name in CTools, because we don't know htat what's being displayed is a panel. For example, if using context admin, we'll get an 'edit panel' link which is wrong. That's why the link title had previously been constructed from information in the handler.

dawehner’s picture

Oh right.

Here is the new version of the patch, which uses this generated title.

merlinofchaos’s picture

Status: Needs review » Fixed

Seems to work and looks solid. Committed.

Status: Fixed » Closed (fixed)

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

dawehner’s picture

There is somehow a problem here.

If you have contextual links in the content of the panels, for example on nodes or views with the current version of drupal you will
probably have some weird problems with it. http://drupal.org/files/issues/screen12_0.png
More details on http://drupal.org/node/1216776 as this is a core bug with a patch. Perhaps this patch here should be reverted until the core patch is in as this will need at least another point release.

Any oppinions?

zhangtaihao’s picture

Please let me know if this is a bad idea.

I reckon you could configure it in a "CTools" setting. I understand there has been no CTools setting, probably for a good reason. This option can then be left on (or off??) by default.

This way, sites with many instances of the screenshot you posted can switch off the option, while those of us with other solutions (e.g. mostly field-based Views embedded in panels) can still have the contextual links.