You are here

function _elevatezoomplus_slider_settings_alter in ElevateZoom Plus 8

Implements hook_slider_settings_alter().

2 calls to _elevatezoomplus_slider_settings_alter()
elevatezoomplus_slick_settings_alter in ./elevatezoomplus.module
Implements hook_slick_settings_alter().
elevatezoomplus_splide_settings_alter in ./elevatezoomplus.module
Implements hook_splide_settings_alter().

File

./elevatezoomplus.module, line 171
Provides ElevateZoomPlus integration.

Code

function _elevatezoomplus_slider_settings_alter(array &$build, $items) {
  $settings =& $build['settings'];

  // Ensures overrides do not break existing Slick logic for other conditions.
  if (elevatezoomplus()
    ->isApplicable($settings)) {

    // Forces Slick|Splide to always use nav _only if intended to have one.
    // Slick|Splide only considers a nav if count > 1, this is an enforce.
    $settings['nav'] = !empty($settings['optionset_nav']) || !empty($settings['optionset_thumbnail']);

    // Two things to address to with the current Slick|Splide logic:
    // 1. Tricks count > 1 to negate unslick _only if really 1.
    // 2. Required count > 1 to display the item wrapper in an unslick mode.
    // Known Slick version which doesn't behave with count 1 is Slick 1.6.0.
    // Splide has no issues found.
    $settings['count'] = count($items) == 1 ? 2 : count($items);
  }
}