Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
frjo CreditAttribution: frjo commentedTry using Colorbox on a standard image field first and make sure it works there.
Comment #2
drupalpal CreditAttribution: drupalpal commentedI 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.
Comment #3
frjo CreditAttribution: frjo commentedGlad you got it working.