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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nodecode’s picture

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.

ajmartin’s picture

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

tfranz’s picture

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

Line 160ff:

// 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".

BWPanda’s picture

Version: 7.x-1.3 » 7.x-2.x-dev
Status: Active » Needs review
FileSize
1.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.

frjo’s picture

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

frjo’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

haradhansharma’s picture

Issue summary: View changes

i am using 7x2.5 of colorbox. Just type [nid] in "Custom Colorbox gallery " but didnt grouped the image per post. Would anybody advise an example to implement. I want to make per post galary in the view using replacement patern in popup.