You are here

function juicebox_library_post_detect in Juicebox HTML5 Responsive Image Galleries 7.2

Same name and namespace in other branches
  1. 8.2 juicebox.module \juicebox_library_post_detect()

Libraries API Post-Detect Callback

Add detailed variables to a Juicebox library array after the version info can be detected.

See also

juicebox_libraries_info()

1 call to juicebox_library_post_detect()
juicebox_library_detect in ./juicebox.module
Get/detect the details of a Juicebox javascript library without loading it.
1 string reference to 'juicebox_library_post_detect'
juicebox_libraries_info in ./juicebox.module
Implements hook_libraries_info().

File

./juicebox.module, line 391
Provides Drupal integration with the Juicebox library. This file contains the relevant Drupal hook implementations and callbacks.

Code

function juicebox_library_post_detect(&$library) {
  $pro = FALSE;
  $disallowed_conf = array();
  if (!empty($library['version'])) {

    // Check if this is a Pro version.
    if (stripos($library['version'], "Pro") !== FALSE) {
      $pro = TRUE;
      $library['base_languagelist'] = 'Show Thumbnails|Hide Thumbnails|Expand Gallery|Close Gallery|Open Image in New Window|Next Image|Previous Image|Play Audio|Pause Audio|Show Information|Hide Information|Start AutoPlay|Stop AutoPlay|AutoPlay ON|AutoPlay OFF|Go Back|Buy this Image|Share on Facebook|Share on Twitter|Share on Google+|Share on Pinterest|Share on Tumblr|of';
    }

    // Get numeric part of the version statement.
    $version_number = 0;
    $matches = array();
    preg_match("/[0-9\\.]+[^\\.]\$/u", $library['version'], $matches);
    if (!empty($matches[0])) {
      $version_number = $matches[0];
    }

    // Some options are not available as LITE options < v1.3.
    if (!$pro && version_compare($version_number, '1.3', '<')) {
      $disallowed_conf = array_merge($disallowed_conf, array(
        'jlib_textColor',
        'jlib_thumbFrameColor',
        'jlib_useFullscreenExpand',
        'jlib_useThumbDots',
      ));
    }

    // Multisize features are only available in PRO >= v1.4
    if (!$pro || version_compare($version_number, '1.4', '<')) {
      $disallowed_conf = array_merge($disallowed_conf, array(
        'juicebox_multisize_image_style',
      ));
    }
  }
  $library['pro'] = $pro;
  $library['disallowed_conf'] = $disallowed_conf;
}