Hi,

I am struggling to know how can I load and call colorbox in my custom drupal module. I have downloaded and enabled the module and the library and enabled colorbox load and colorbox inline in my colorbox configuration page.

$description="Open the file";
$url=file_create_url($indv_file['uri']);
$url=$url."?width=500&height=500";
print '<div class="action_list">'.l($description,$url,array('attributes' =>array('class'=>'colorbox-load'))).'</div>';

But it appears that the colorbox is not loaded in the first place in my module (no colorbox javascript library is being loaded in my module), and I am not sure that the code that I have written is satisfactory to display the link content (the link is for an image) in a colorbox.

Your help is very much appreciated.

Thanks!

Comments

frjo’s picture

Try using Colorbox on a standard image field first and make sure it works there.

drupalpal’s picture

I found out that colorbox was deactivated on my page (admin/ppi). This was due to the fact that by default colorbox is deactivated on the admin pages. This can be changed by navigating into colorbox configuration page >Advanced Settings > Deactivate colorbox on specific pages and remove the path of the page you are interested in using colorbox in.Hope this helps someone.

frjo’s picture

Status: Active » Fixed

Glad you got it working.

Status: Fixed » Closed (fixed)

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