I would like to be able to use [nid] as the custom gallery of the Colorbox trigger field. Thereby creating a per post gallery for each view result. This doesn't seem possible at the moment - please correct me if I'm wrong...

Files: 

Comments

I agree this is very necessary. I'm trying to work around this by rewriting the output of the field but so far I haven't figured it out yet.

I had an attempt at that too, without success. I'd be keen to know if you find a work around. The only way I can see to make it happen is by allowing replacement patterns in the custom gallery...

My solution was this:
Changed some lines in modules/colorbox/views/colorbox_handler_field_colorbox.inc (Colorbox 7.x-2.3)

Line 160ff:

<?php
// Get the token information and generate the value for the popup and the
    // caption.
   
$tokens = $this->get_render_tokens($this->options['alter']);
   
$popup = filter_xss_admin($this->options['popup']);
   
$caption = filter_xss_admin($this->options['caption']);
   
$popup = strtr($popup, $tokens);
   
$caption = strtr($caption, $tokens);
   
$customgallerieid = filter_xss_admin($this->options['custom_gid']);   // <- THIS LINE IS NEW
   
$customgallerieid = strtr($customgallerieid, $tokens);  // <- THIS LINE IS NEW
   
$width = $this->options['width'] ? $this->options['width'] : '';
   
$height = $this->options['height'] ? $this->options['height'] : '';
   
$gallery_id = !empty($this->options['custom_gid']) ? $customgallerieid : ($this->options['gid'] ? 'gallery-' . $this->view->name : ''); // <- THIS LINE CHANGED
?>

After that you can use tokens – for example [nid] – in the field "Custom Colorbox gallery".

Version:7.x-1.3» 7.x-2.x-dev
Status:Active» Needs review
StatusFileSize
new1.86 KB

Here's a patch of the changes from #3, with the addition of the line: You may enter data from this view as per the "Replacement patterns" below. to the description of the Custom Colorbox gallery field.

Works for me.

Committed to 7.x-2.x. Thanks for the contribution BWPanda!

Status:Needs review» Fixed

Status:Fixed» Closed (fixed)

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