colorbox.api.php 1.17 KB
Newer Older
frjo's avatar
frjo committed
1
2
3
4
5
6
7
8
9
10
<?php

/**
 * @file
 * API documentation for the colorbox module.
 */

/**
 * Allows to override Colorbox settings and style.
 *
11
 * Implements hook_colorbox_settings_alter().
12
 *
frjo's avatar
frjo committed
13
14
15
16
17
 * @param $settings
 *   An associative array of Colorbox settings. See the
 *   @link http://colorpowered.com/colorbox/ Colorbox documentation @endlink
 *   for the full list of supported parameters.
 * @param $style
18
19
 *   The name of the active style plugin. If $style is 'none', no Colorbox
 *   theme will be loaded.
frjo's avatar
frjo committed
20
21
22
23
24
25
26
27
28
29
 */
function hook_colorbox_settings_alter(&$settings, &$style) {
  // Disable automatic downscaling of images to maxWidth/maxHeight size.
  $settings['scalePhotos'] = FALSE;

  // Use custom style plugin specifically for node/123.
  if ($_GET['q'] == 'node/123') {
    $style = 'mystyle';
  }
}
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

/**
 * Allows to override activation of Colobox for the current URL.
 *
 * @param $active
 *   A boolean indicating whether colorbox should be active for the current
 *   URL or not.
 */
function hook_colorbox_active_alter(&$active) {
  $path = drupal_get_path_alias($_GET['q']);
  if (drupal_match_path($path, 'admin/config/colorbox_test')) {
    // Enable colorbox for this URL.
    $active = TRUE;
  }
}