Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've created a patch + submodule to add the ability to have a 'is Colorbox Node' check in Panels. With this option it is possible to create a custom panel layout for a node that is displayed in Panels. It adds a $_GET['is_colorbox_node'] to the page. So als other templating options can use this check.
Patch file is in next post.
Comment | File | Size | Author |
---|---|---|---|
#16 | provide-ctools-access-plugin-1717308-16.patch | 2.94 KB | Andre-B |
#1 | colorbox_node-add_panels_support-1717308-1.patch | 4.99 KB | joostvdl |
Comments
Comment #1
joostvdl CreditAttribution: joostvdl commentedPatch file
Comment #2
iLLin CreditAttribution: iLLin commentedI am unclear as to what this actually does as I do not use panels. Can you elaborate a little more on the need here?
Comment #3
joostvdl CreditAttribution: joostvdl commentedWhen I want Panels to create a different layout when showing a node in a colorbox I need a way to identify the state of a node rendered via Colorbox Node. When viewing a node without Colorbox I want to have a different layout. In the submodule I created an access plugin for Panels that detects the $_GET['is_colorbox_node']. When detected it can do a node override an impose the new panels based layout.
The two changes are divided into:
Another solution could be creating something with context. But I couldn't get that working where my limited knowledge is the problem ;-)
Comment #4
iLLin CreditAttribution: iLLin commentedOK, is this the proper solution here: #1662630: Not using Colorbox display from Manage Display page
Comment #5
iLLin CreditAttribution: iLLin commentedComment #7
dargente CreditAttribution: dargente commentedThis module worked perfectly to display colorbox webforms in panels.
Def think it should be patched into Colorbox Node.
Comment #8
DMM CreditAttribution: DMM commentediLLin,
I don't think the solution you mentioned above is related to this issue. This patch allows panels to change access or visibility based on whether the page is being displayed in colorbox or not.
For example, panels allows you to load additional contexts such as author information, referenced entities, views etc. and place them on the page. This patch provides the ability to selectively exclude or include this information based on whether the page is being displayed within colorbox or not.
I agree with dargente that it should be included in the module (especially since its so simple).
Comment #9
iLLin CreditAttribution: iLLin commentedIsn't that what the "view mode" is for? You are adding to the GET global... what for when you can queue off the view mode? I'm not convinced this is the solution, please look into the view mode and I don't see why panels wouldn't be able to use that, its built into core...
Comment #10
DMM CreditAttribution: DMM commentedThe view mode certainly lets me change the way an entity is displayed but it does not let me change the other areas of the page (when using panels). Here's another example that is, hopefully, more clear. I have a panel that displays a node in the main part of the page. Next to the node I have placed a view that will display a list of recent content written by the author. Currently, I don't have a way to eliminate this view in ColorBox. This patch allows me to use the visibility settings in panels to completely exclude this view (or any other page element) from the page when it is displayed using ColorBox.
In fact, with this patch I can use selection rules in panels to create an entirely different page for ColorBox if I wanted.
Now, it may be that the GET global is not the best way to do this but it does show how this can work.
NodeOne has an excellent screencast on panels that might shed some light Learn Page Manager
Dave
Comment #11
iLLin CreditAttribution: iLLin commentedSo you have multiple "pieces" inside a panel page that you are wanting to display in a colorbox.j I understand now, thx for the explanation!
Hmmm, so I am not a fan of adding a GET variable to queue off of. How do you use that GET variable within panels to change the display? Do you hack panels too? I wonder if context is the solution instead, as was mentioned above? Thoughts?
Comment #12
iLLin CreditAttribution: iLLin commentedAdded context integration as a test to see if this will work for you:
https://drupal.org/commitlog/commit/38370/444573d8296e81bcd3e949c4f46a2b...
It will basically execute the context when viewing the content within a colorbox modal. Since it grabs the content from the menu, I couldn't really "test" if it worked correctly and I don't know how to use panels :). But let me know if this is the direction we need to go and if it works for you.
If it does, I will probably rename it to reference panels as thats really all this would be good for.
Comment #13
DMM CreditAttribution: DMM commentedI think that your plugin is for the context module which might also be good to add but I haven't used that module . I was able to change the original patch to include the arg(0) check and it worked fine for my use.
Changed to this:
and it worked fine. I was then able to eliminate the hack to the colorbox_node module.
Dave
Comment #14
iLLin CreditAttribution: iLLin commentedComment #15
Andre-Bthere is a difference between http://drupal.org/project/context and panel's selection rules - in panels those rules are called access plugins, I am not aware of any solution to integrate those with the context module (which your integration was written for iLLin).
going to provide a patch to add a access plugin for ctools based on this issue.
Comment #16
Andre-Bpatch created with git-format patch against 7.x-3.x
Comment #17
Andre-BComment #18
Andre-BThis should get mentioned on the project page and get documented somewhere as well.
user documentation:
Howto Visibility Rule:
Comment #19
iLLin CreditAttribution: iLLin commentedCommitted to DEV: http://drupalcode.org/project/colorbox_node.git/commit/f04dd87
Comment #20
iLLin CreditAttribution: iLLin commentedDocumentation on the homepage, please test (as I don't use panels) and then I will get a new release out.
Comment #21
jcam88 CreditAttribution: jcam88 commentedJust installed current dev versions of Colorbox and Colorbox_Node, Ctools installed. Added the panels selection rule "Colorbox Node". Panel is not displaying content in a colorbox. Have I missed something? My custom node template panel is showing the page in standard Drupal form. The panel regions and panes are not recognized.
Comment #22
Andre-BI just double checked the panels integration and it worked without problems on a fresh installation. Can you provide more details about the panel your are creating? export/ screenshots?
also make sure you have your variants in a proper order - if you put a matching variant before the colorbox node variant, the colorbox node variant will never be used.
Comment #23
jcam88 CreditAttribution: jcam88 commentedIf this helps any. Here is an error report after adding the colorbox_node selection rule to my panel Node Template.
LOCATION /ctools/context/ajax/access/add/page_manager_task_handler-node_view%2Anode_view_panel_context_3/is_colorbox_node
REFERRER /admin/structure/pages/nojs/operation/node_view/handlers/node_view_panel_context_3/criteria
MESSAGE Notice: Undefined index: settings in ctools_access_ajax_edit_item_submit() (line 436 of /sites/all/modules/ctools/includes/context-access-admin.inc).
If I understand this correctly: With colorbox_node added to the panel, visiting any node should display the node in a colorbox?
Comment #24
Andre-BI am not sure if you understand the purpose of the selection rule correctly, visiting the node through the usual page requests and/ or links will not put it automatically in a colorbox. the rule is there to provide different panels variant for the usual page load and a page load within the colorbox, using the default implementations with
<a href="node/id" class="colorbox-node" data-inner-width="600" data-inner-width="600">open in colorbox</a>
I also can not replicate the error messages you provided, I am guessing that you have an error somewhere else.
Comment #25
jcam88 CreditAttribution: jcam88 commentedThank you for the clarification. This sounded like an alternative to https://drupal.org/project/overlay_paths.
I will have to track down the error I'm getting. Seems like it's causing the issue I first reported.
Comment #26
iLLin CreditAttribution: iLLin commentedComment #28
drett CreditAttribution: drett commentedRe-posting in another issue as this one is closed. Hope that's the correct etiquette.
Comment #29
Salif CreditAttribution: Salif commentedHi,
I'm facing an AJAX error when adding a selection rules (of any type) in panel node variant.
I've try every thing I can do to fin a solution. but no success.
I'm using Colorbox 7.x-2.8
Colorbox-node 7.x-3.4
Panels 7.x-3.4
With Commerce Kickstart 7.x-2.21 (same issue with 7.x-2.20)
The error occurs when I go to edit node-view / edit variant / selections rule/ ... select a node type colorbox node or any other / click add.
Here is the error message
Comment #30
Salif CreditAttribution: Salif commentedThe culprit for my issue was that the memcache statistics were enabled.
I've solved it by disabling "show memcache statistics".
Go to admin > config > memcache (Configuration -> Memcache)
uncheck "Show memcache statistics at the bottom of each page"
This solution was suggested by erikweeb and comes from here: https://www.drupal.org/node/1367060#comment-7098220