I'd like to display simple inline content using colorbox (an embedded flash object, or something similar). Is there an easy way to do this using the colorbox module? I am extremely familiar with templates and views, I'm just not sure how to write the markup - nothing obvious in the docs or issue queue.

CommentFileSizeAuthor
#5 colorbox_inline_921206_5.patch3.42 KBfrjo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

frjo’s picture

The home page for the Colorbox plugin has some information how to use it. See e.g. http://colorpowered.com/colorbox/core/example4/index.html

j0rd’s picture

That example does not show one how to use colorbox to display inline content with this drupal module.

I'm looking for a specific example on how to do it with the Drupal module (which does things differently)

obrienmd’s picture

^ agreed with #2. It's not clear how to use the drupal module (in code or UI, preferably code) to open inline content in a colorbox.

hutch’s picture

The file views/colorbox_handler_field_colorbox.inc contains code that uses the inline features of colorbox, in particular you will need to ensure that the right js is running with:

drupal_add_js(drupal_get_path('module', 'colorbox') .'/js/colorbox_inline.js');

To build a link to that content you can use something like:

$link_tag = l($link_text, '', array('html' => TRUE, 'fragment' => 'colorbox-inline-'. $i, 'query' => 'width='. $width .'&height='. $height .'&inline=true', 'attributes' => array('title' => $caption, 'class' => 'colorbox-inline', 'rel' => $gallery_id)));

'fragment' should point to where the content you want to show is, eg the id of a hidden div.
Obviously you will need to give the various variables, $link_text, $width etc some sensible values.

This should get you started ;-)

frjo’s picture

Category: support » feature
Status: Active » Needs review
FileSize
3.42 KB

Please try out this patch and report back how it works for you.

It adds a setting to activate colorbox_inline.js with a short description how to use it. Here is one example use:

<a class="colorbox-inline" href="?width=500&height=500&inline=true#id-of-content">Open inline content in a colorbox</a>

<div style="display:none;"><div id="id-of-content">This is the inline content.</div></div>
frjo’s picture

Status: Needs review » Fixed

Committed to 6-dev.

Status: Fixed » Closed (fixed)

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

sadist’s picture

Has this been committed to the latest 6.x-1.0-beta9? Am I supposed to see an option for me to have Colorbox for Title links in Views?

Edit: Sorry, I think I'd just found it. Thanks so much for the feature!