Problem/Motivation
Panels IPE is a great module that simplifies interaction with site for content editors. I've used it on a lot of projects and was satisfied. But, also, it have a small lack for me: pane options are limited for In-Place Editor.
In administrative interface we can see the following contextual links:

while IPE has only three links:

Proposed resolution
My patch improve the module and allow to use all contextual links for pane without code dublication. Also, new links can be easily added.
User interface changes
The Options button is an interactive. After click on it, contextual menu will be shown.

API changes
To the hook_get_pane_links_alter() was added a new parameter - an instance of the panels_renderer_editor object.
Comments
Comment #1
br0kenComment #2
br0kenComment #3
m1r1k commentedWhy is it better then old good $('.' + menu_class, context)?
Why is it better then storing these classes as local string variable with internal definition?
Wrong hook comment
This comment is useless. add info about actual theme name and description. The same for other theme implementations.
use theme('links')
Don't we really need alter here?
Put NULL instead of 0 (see ctools_get_plugins())
Comment #4
br0ken1. Added the comment in patch #4.
2. Because this is a parameters, not variables.
3. Fixed in patch #4.
4. The PHPDoc comment with "@see" tag has been added to each theme function.
5. "theme_links" function is better than "theme('links')", because we avoid additional checking in "theme()" function. Using of "theme()" function is better for contrib theme suggestions or if suggestion stored in variable.
6. "Alter" was and should be here. We cannot so easily remove the used functionality.
7. Fixed in patch #4.
Also, patch contains a lot of code refactoring and small improvements.
Comment #5
br0kenComment #6
br0kenSorry, forgot about interdiff.
Comment #7
br0kenHm, guys, I've completely forgot to add the JavaScript file. The patch #4 is wrong and patch #7 must be used instead.
Comment #8
sirko_el commentedI've applied this patch on a fresh panopoly build and here is what I've got:
Strict warning: Declaration of panels_renderer_ipe::render_region() should be compatible with that of panels_renderer_editor::render_region() in require_once() (line 10 of profiles/panopoly/modules/contrib/panels/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php).
Strict warning: Declaration of panels_renderer_ipe::render_pane() should be compatible with that of panels_renderer_editor::render_pane() in require_once() (line 10 of profiles/panopoly/modules/contrib/panels/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php).
Strict warning: Declaration of panels_renderer_ipe::render_pane_content() should be compatible with that of panels_renderer_standard::render_pane_content() in require_once() (line 10 of panopoly/profiles/panopoly/modules/contrib/panels/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php).
Also there is no possibility save page from IPE. See attached screenshot.
Comment #9
br0kenThank you for your feedback. An issue was fixed. Could you apply this one and inform me about result? Thank you again.
Comment #10
m1r1k commentedBack to theme_links()
Using it directly you're omitting:
However, panels_renderer_editor.class.php uses the same approach, so....
Comment #11
br0kenOkay, agree with you. I've replaced "theme_links()" by "theme('links', $arguments)".
Comment #12
sirko_el commented#11 works as a charm for me. Good work!
Comment #13
podarokLooks good #11
Let's have it merged to upcoming release
Comment #14
br0kenComment #15
temoor commented#14 works well.
Comment #16
br0kenSorry, @Temoor, can you make a manual code review once again? I've added the permission for deleting panels.
Comment #17
temoor commentedCheck default panels page - style of contextual menu for panes broken.
Comment #18
br0kenNo need to check admin pages additionally, because the one method for all pages is used. But, in this patch, I've corrected the notices when user is not permitted to delete panes.
Comment #19
temoor commented#18 fixed issue with empty pane actions menu as well. It was bottom links array, that was null for role with poor permissions.
Comment #20
japerryOne of the nice pieces of panelizer is the ability to restrict edit abilities to certain roles or users per content type. This patch would open existing sites to potential security issues because new functionality would be given to potentially unprivileged users (who have limited panelizer access)
At a minimum, this feature should be wrapped into opt-in permissions.
Secondly, this patch offers a bunch of code cleanup. While in general I think thats great to clean up code, it potentially breaks other patches while not providing functionality. If we're doing a general code cleanup, that should be its own clean patch (which other issues can be re-rolled against)
Comment #21
br0kenBut I did nothing that breaks permissions. If you look at the patch once again then you can see that all
user_accessfunctions is in place and new one was addeduser_access('allow deleting panels'). So, no one group of links will not be shown without permissions.Comment #22
br0ken@japerry, I need remove too many changes ... I don't want do this, because was spent a lot of time to make them.
This patch provides possibility to use contextual links wherever you want. Also, I've already wrote a module on its basis...
Your statement about other patches is equitable, but other patches are not so big as this one. Think you need take the plunge and merge this patch into development branch.
If necessary, I will work on each problematic patch when this be merged.
Comment #23
japerryOkay, so upon further review -- it looks like permissions are being respected for unprivileged users with IPE access. There was concern around giving group administrators elevated privileges because the contextual menu may expose links that aren't properly checking access. While this wouldn't be a bug in panels, I didn't want this patch to unintentionally expose security issues. Luckily it appears (right now) that its not the case. So this is a moot point.
On the second part, in general we like to split up patches into syntax and features. Panels is at a stable release right now, and many people run the dev version as well as the release. Every patch that makes it into panels shouldn't break head. Thats why we have smaller patches, per issue, so its easier to review.
Comment #24
dsnopek@BR0kEN: Thanks for making this patch and putting all the effort you've put into it!
Unfortunately, this is really hard to review because of all the unrelated changes. It would take quite a bit of time just to sift through which changes are necessary to implement this functionality and which are just fixing coding style. As the author of the patch, this should be easier for you! Also, the size of the patch makes it difficult to tell if these changes would have collateral damage on something else, which is super important given the level of stability of Panels.
I'd like to second @japerry's call to break reduce this patch to just the changes necessary to implement this functionality, and then start a new issue for the coding style fixes.
Thanks again!
Comment #25
mglamanPatch makes a lot of changes I'd love to see, however not all at once. It will for sure break work done in #2462331: IPE insufficient for Panelizer (data loss when using revisions). Then there's issues with code, and it's hard to review because of changes.
New permission is defined, is called, but never added to a role with relevance?
So now people can't delete items in IPE unless permissions updated? I mean, a change record would fix. But there should be kind of update to add this to users who can already handle this functionality.
Comment #26
damienmckenna+1 for separating off the misc improvements, and I'll be happy to help review it :)
Comment #27
japerryDrupal 7 is no longer supported, closing.