You are here

public function Slick::removeWastedDependentOptions in Slick Carousel 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Slick.php \Drupal\slick\Entity\Slick::removeWastedDependentOptions()
  2. 7.3 src/Entity/Slick.php \Drupal\slick\Entity\Slick::removeWastedDependentOptions()

Removes wasted dependent options, even if not empty.

1 call to Slick::removeWastedDependentOptions()
Slick::removeDefaultValues in src/Entity/Slick.php
Strip out options containing default values so to have real clean JSON.

File

src/Entity/Slick.php, line 286

Class

Slick
Defines the Slick configuration entity.

Namespace

Drupal\slick\Entity

Code

public function removeWastedDependentOptions(array &$js) {
  foreach (self::getDependentOptions() as $key => $option) {
    if (isset($js[$key]) && empty($js[$key])) {
      foreach ($option as $dependent) {
        unset($js[$dependent]);
      }
    }
  }
  if (!empty($js['useCSS']) && !empty($js['cssEaseBezier'])) {
    $js['cssEase'] = $js['cssEaseBezier'];
  }
  unset($js['cssEaseOverride'], $js['cssEaseBezier']);
}