You are here

function slick_remove_wasted_dependent_options in Slick Carousel 7.2

Removes wasted dependent options, even if not empty.

2 calls to slick_remove_wasted_dependent_options()
SlickUi::edit_form_submit in slick_ui/plugins/export_ui/SlickUi.class.php
Overrides the edit form submit handler.
_slick_remove_default_optionset_options in templates/slick.theme.inc
Strips out options similar to default values from the optionset options.

File

templates/slick.theme.inc, line 601
Hooks and preprocess functions for the Slick module.

Code

function slick_remove_wasted_dependent_options(array &$config = array()) {
  $options = array(
    'autoplay' => array(
      'pauseOnHover',
      'pauseOnDotsHover',
      'autoplaySpeed',
    ),
    'centerMode' => array(
      'centerPadding',
    ),
    'dots' => array(
      'dotsClass',
      'appendDots',
    ),
    'rows' => array(
      'slidesPerRow',
    ),
    'swipe' => array(
      'swipeToSlide',
    ),
    'vertical' => array(
      'verticalSwiping',
    ),
    'useCSS' => array(
      'cssEase',
      'cssEaseBezier',
      'cssEaseOverride',
    ),
  );
  foreach ($options as $key => $option) {
    if (isset($config[$key]) && empty($config[$key])) {
      foreach ($option as $dependent) {
        unset($config[$dependent]);
      }
    }
  }
  if (!empty($config['useCSS']) && !empty($config['cssEaseBezier'])) {
    $config['cssEase'] = $config['cssEaseBezier'];
  }
  unset($config['cssEaseOverride'], $config['cssEaseBezier']);
}