You are here

public function Slick::getResponsiveOptions in Slick Carousel 8

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

Returns the Slick responsive settings.

Return value

array The responsive options.

1 call to Slick::getResponsiveOptions()
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 198

Class

Slick
Defines the Slick configuration entity.

Namespace

Drupal\slick\Entity

Code

public function getResponsiveOptions() {
  if (empty($this->breakpoints)) {
    return FALSE;
  }
  $options = [];
  if (isset($this->options['responsives']['responsive'])) {
    $responsives = $this->options['responsives'];
    if ($responsives['responsive']) {
      foreach ($responsives['responsive'] as $delta => $responsive) {
        if (empty($responsives['responsive'][$delta]['breakpoint'])) {
          unset($responsives['responsive'][$delta]);
        }
        if (isset($responsives['responsive'][$delta])) {
          $options[$delta] = $responsive;
        }
      }
    }
  }
  return $options;
}