You are here

function hook_juicebox_classes_alter in Juicebox HTML5 Responsive Image Galleries 7.2

Same name and namespace in other branches
  1. 8.3 juicebox.api.php \hook_juicebox_classes_alter()
  2. 8.2 juicebox.api.php \hook_juicebox_classes_alter()

Allow modules to alter the classes that are instantiated when a Juicebox object is created.

Parameters

array $classes: An associative array containing the class names that will be instantiated:

  • gallery: A gallery object dependency (implementing JuiceboxGalleryInterface) that's used to create the script and markup outputs of a Juicebox gallery.
  • juicebox: A Juicebox gallery wrapper (implementing JuiceboxGalleryWrapperInterface) that will be used to wrap/decorate the gallery object with Drupal-specific logic and structures.

array $library: Juicebox javascript library data as provided through Libraries API. Provided for context.

See also

juicebox()

1 invocation of hook_juicebox_classes_alter()
juicebox in ./juicebox.module
Factory to instantiate a Juicebox object along with its dependencies.

File

./juicebox.api.php, line 64
Hooks provided by the Juicebox module.

Code

function hook_juicebox_classes_alter(&$classes, $library) {

  // Provide custom (global) overrides to a Juicebox library.
  $classes['juicebox'] = 'MyJuiceboxGalleryWrapper';

  // Swap out the gallery dependency object because some future Juicebox
  // javascript library requires different embed or XML output.
  if (!empty($library['version']) && $library['version'] == 'Pro 12.3') {
    $classes['gallery'] = 'FutureJuiceboxGallery';
  }
}