You are here

function hook_masonry_script_alter in Masonry API 7.2

Same name and namespace in other branches
  1. 8 masonry.api.php \hook_masonry_script_alter()
  2. 7.3 masonry.api.php \hook_masonry_script_alter()

Alter the Masonry script.

Parameters

$masonry: An array of Masonry options to send to the script file.

$script_file: A path to the javascript file that triggers Masonry.

$context: An associative array of additional variables. Contains:

  • container: The CSS selector of the container element to apply Masonry to.
  • options: An associative array of Masonry options. See masonry_apply().
1 invocation of hook_masonry_script_alter()
masonry_apply in ./masonry.module
Apply Masonry to a container.

File

./masonry.api.php, line 59
Hooks provided by Masonry.

Code

function hook_masonry_script_alter(&$masonry, &$script_file, $context) {
  $container = $context['container'];
  $options = $context['options'];

  // Send easing option to the script file
  $masonry['masonry'][$container]['animation_easing'] = $options['masonry_animation_easing'];

  // Use a custom javascript file that includes easing in the animationOptions
  $script_file = drupal_get_path('module', '[MODULE_NAME]') . '/custom_masonry.js';
}