root / drupal7 / sites / all / modules / colorbox / colorbox.api.php @ 73ab1d0a
1 |
<?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 |
* @param array $settings
|
14 |
* 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 |
* @param string $style
|
18 |
* 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 |
|
31 |
/**
|
32 |
* Allows to override activation of Colorbox for the current URL.
|
33 |
*
|
34 |
* @param bool $active
|
35 |
* 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 |
} |