Projet

Général

Profil

Paste
Télécharger (1,26 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / colorbox / colorbox.api.php @ b433176d

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
 * @param string $style
16
 *   The name of the active style plugin. If $style is 'none', no Colorbox
17
 *   theme will be loaded.
18
 *
19
 * @link http://colorpowered.com/colorbox/ Colorbox documentation @endlink
20
 *   for the full list of supported parameters.
21
 *
22
 * @codingStandardsIgnoreStart
23
 */
24
function hook_colorbox_settings_alter(&$settings, &$style) {
25
  // @codingStandardsIgnoreEnd.
26
  // Disable automatic downscaling of images to maxWidth/maxHeight size.
27
  $settings['scalePhotos'] = FALSE;
28

    
29
  // Use custom style plugin specifically for node/123.
30
  if ($_GET['q'] == 'node/123') {
31
    $style = 'mystyle';
32
  }
33
}
34

    
35
/**
36
 * Allows to override activation of Colorbox for the current URL.
37
 *
38
 * @param bool $active
39
 *   A boolean indicating whether colorbox should be active for the current
40
 *   URL or not.
41
 */
42
function hook_colorbox_active_alter(&$active) {
43
  $path = drupal_get_path_alias($_GET['q']);
44
  if (drupal_match_path($path, 'admin/config/colorbox_test')) {
45
    // Enable colorbox for this URL.
46
    $active = TRUE;
47
  }
48
}