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 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 b433176d Assos Assos
 *   An associative array of Colorbox settings. See the.
15 39a3d70c Assos Assos
 * @param string $style
16 85ad3d82 Assos Assos
 *   The name of the active style plugin. If $style is 'none', no Colorbox
17
 *   theme will be loaded.
18 b433176d Assos Assos
 *
19
 * @link http://colorpowered.com/colorbox/ Colorbox documentation @endlink
20
 *   for the full list of supported parameters.
21
 *
22
 * @codingStandardsIgnoreStart
23 85ad3d82 Assos Assos
 */
24
function hook_colorbox_settings_alter(&$settings, &$style) {
25 b433176d Assos Assos
  // @codingStandardsIgnoreEnd.
26 85ad3d82 Assos Assos
  // 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 62f5c69e Assos Assos
35
/**
36 39a3d70c Assos Assos
 * Allows to override activation of Colorbox for the current URL.
37 62f5c69e Assos Assos
 *
38 39a3d70c Assos Assos
 * @param bool $active
39 62f5c69e Assos Assos
 *   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
}