You are here

function hook_masonry_script_alter in Masonry API 8

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

Alter the Masonry script.

Parameters

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

$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()
MasonryService::applyMasonryDisplay in src/Services/MasonryService.php
Apply Masonry to a container.

File

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

Code

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

  // Send easing option to the script file
  // Note: this new option has to be introduce via hook_masonry_options_form_alter()
  // otherwise use extra_options.
  $masonry['masonry'][$container]['animation_easing'] = $options['layoutAnimationEasing'];

  // Set the option "horizontalOrder" to true.
  // Note that this option is not included into the predefined options
  // @see MasonryService::getMasonryDefaultOptions
  $masonry['masonry'][$container]['extra_options']['horizontalOrder'] = TRUE;
}