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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joostvdl’s picture

Status: Active » Needs review
FileSize
4.99 KB

Patch file

iLLin’s picture

I am unclear as to what this actually does as I do not use panels. Can you elaborate a little more on the need here?

joostvdl’s picture

When 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:

  1. Add $_GET to have a checksum
  2. Add Panels Plugin

Another solution could be creating something with context. But I couldn't get that working where my limited knowledge is the problem ;-)

iLLin’s picture

iLLin’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

dargente’s picture

This module worked perfectly to display colorbox webforms in panels.
Def think it should be patched into Colorbox Node.

DMM’s picture

Status: Closed (fixed) » Needs review

iLLin,

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

iLLin’s picture

Isn'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...

DMM’s picture

The 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

iLLin’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Needs work

So 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?

iLLin’s picture

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

DMM’s picture

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

function colorbox_node_ctools_ctools_access_check($conf, $context) {
  if (isset($_GET['is_colorbox_node'])) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}

Changed to this:

function colorbox_node_ctools_ctools_access_check($conf, $context) {
  if ( arg(0) == 'colorbox' ) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}

and it worked fine. I was then able to eliminate the hack to the colorbox_node module.

Dave

iLLin’s picture

Status: Needs work » Closed (fixed)
Andre-B’s picture

Status: Closed (fixed) » Active

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

Andre-B’s picture

patch created with git-format patch against 7.x-3.x

Andre-B’s picture

Status: Active » Needs review
Andre-B’s picture

This should get mentioned on the project page and get documented somewhere as well.

user documentation:

  • Use colorbox integration as a selection rule for your variants.
  • Use colorbox integration as a visiblity rule for your panes (you dont have to change the complete variant)

Howto Visibility Rule:

  1. visit your Panel "Content" tab.
  2. under Visibility rules for a pane select "add new rule".
  3. check "Colorbox Node", click next.
    • If you want to show the pane just click save and you are done.
    • If you want to hide the pane in mobile check the "Reverse (NOT)" checkbox and save.
iLLin’s picture

iLLin’s picture

Documentation on the homepage, please test (as I don't use panels) and then I will get a new release out.

jcam88’s picture

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

Andre-B’s picture

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

jcam88’s picture

If 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?

Andre-B’s picture

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

jcam88’s picture

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

iLLin’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

drett’s picture

Category: Feature request » Bug report
Issue summary: View changes

Re-posting in another issue as this one is closed. Hope that's the correct etiquette.

Salif’s picture

Hi,
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

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: http://www.savabien.com/en/ctools/context/ajax/access/add/page_manager_task_handler-node_view%2Anode_view_panel_context_2/is_colorbox_node
StatusText: OK
ResponseText: [{"command":"settings","settings":{"basePath":"\/","pathPrefix":"en\/","ajaxPageState":{"theme":"commerce_kickstart_admin","theme_token":"JDiqvLT9Dg98ZHg7W8XQUZWqeQ_T4CGsiyTxpdZUNw8","css":{"misc\/ui\/jquery.ui.core.css":1,"misc\/ui\/jquery.ui.theme.css":1,"modules\/overlay\/overlay-parent.css":1,"profiles\/commerce_kickstart\/modules\/contrib\/colorbox\/styles\/default\/colorbox_style.css":1},"js":{"sites\/all\/modules\/jquery_update\/replace\/ui\/ui\/minified\/jquery.ui.core.min.js":1,"misc\/jquery.ba-bbq.js":1,"modules\/overlay\/overlay-parent.js":1,"sites\/all\/libraries\/colorbox\/jquery.colorbox.js":1,"profiles\/commerce_kickstart\/modules\/contrib\/colorbox\/js\/colorbox.js":1,"profiles\/commerce_kickstart\/modules\/contrib\/colorbox\/styles\/default\/colorbox_style.js":1,"profiles\/commerce_kickstart\/modules\/contrib\/colorbox\/js\/colorbox_load.js":1,"profiles\/commerce_kickstart\/modules\/contrib\/colorbox\/js\/colorbox_inline.js":1}},"colorbox":{"transition":"none","speed":"600","opacity":"0.85","slideshow":false,"slideshowAuto":true,"slideshowSpeed":"2500","slideshowStart":"start slideshow","slideshowStop":"stop slideshow","current":"{current} of {total}","previous":"\u00ab Prev","next":"Next \u00bb","close":"...YUVpUCVawWL8\u0022 \/\u003E\n\u003Cinput type=\u0022hidden\u0022 name=\u0022form_token\u0022 value=\u0022Ab5PUD5QM2hdG1koV37-AFL4UbuQ7aJiXU1-rAFvFZE\u0022 \/\u003E\n\u003Cinput type=\u0022hidden\u0022…
Salif’s picture

The 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