root / drupal7 / sites / all / modules / colorbox / colorbox.api.php @ 73ab1d0a
1 | 85ad3d82 | Assos Assos | <?php
|
---|---|---|---|
2 | |||
3 | /**
|
||
4 | * @file
|
||
5 | * API documentation for the colorbox module.
|
||
6 | */
|
||
7 | |||
8 | /**
|
||
9 | * Allows to override Colorbox settings and style.
|
||
10 | *
|
||
11 | * Implements hook_colorbox_settings_alter().
|
||
12 | *
|
||
13 | 39a3d70c | Assos Assos | * @param array $settings
|
14 | 85ad3d82 | Assos Assos | * An associative array of Colorbox settings. See the
|
15 | * @link http://colorpowered.com/colorbox/ Colorbox documentation @endlink
|
||
16 | * for the full list of supported parameters.
|
||
17 | 39a3d70c | Assos Assos | * @param string $style
|
18 | 85ad3d82 | Assos Assos | * The name of the active style plugin. If $style is 'none', no Colorbox
|
19 | * theme will be loaded.
|
||
20 | */
|
||
21 | function hook_colorbox_settings_alter(&$settings, &$style) { |
||
22 | // Disable automatic downscaling of images to maxWidth/maxHeight size.
|
||
23 | $settings['scalePhotos'] = FALSE; |
||
24 | |||
25 | // Use custom style plugin specifically for node/123.
|
||
26 | if ($_GET['q'] == 'node/123') { |
||
27 | $style = 'mystyle'; |
||
28 | } |
||
29 | } |
||
30 | 62f5c69e | Assos Assos | |
31 | /**
|
||
32 | 39a3d70c | Assos Assos | * Allows to override activation of Colorbox for the current URL.
|
33 | 62f5c69e | Assos Assos | *
|
34 | 39a3d70c | Assos Assos | * @param bool $active
|
35 | 62f5c69e | Assos Assos | * A boolean indicating whether colorbox should be active for the current
|
36 | * URL or not.
|
||
37 | */
|
||
38 | function hook_colorbox_active_alter(&$active) { |
||
39 | $path = drupal_get_path_alias($_GET['q']); |
||
40 | if (drupal_match_path($path, 'admin/config/colorbox_test')) { |
||
41 | // Enable colorbox for this URL.
|
||
42 | $active = TRUE; |
||
43 | } |
||
44 | } |