public function SliderPro::toOptionSet in Slider Pro 8
Returns an array formatted to use as JS option set.
Return value
array
Overrides SliderProInterface::toOptionSet
File
- src/
Entity/ SliderPro.php, line 110
Class
- SliderPro
- Defines the SliderPro entity.
Namespace
Drupal\slider_pro\EntityCode
public function toOptionSet() {
$optionset = [
'width' => $this
->getOption('width'),
'visibleSize' => $this
->getOption('visible_size'),
'forceSize' => $this
->getOption('force_size'),
'height' => $this
->getOption('height'),
'orientation' => $this
->getOption('orientation'),
'buttons' => $this
->getOption('buttons') ? TRUE : FALSE,
'fade' => $this
->getOption('transition') ? TRUE : FALSE,
'arrows' => $this
->getOption('arrows') ? TRUE : FALSE,
'centerImage' => $this
->getOption('center_image') ? TRUE : FALSE,
'allowScaleUp' => $this
->getOption('allow_scale_up') ? TRUE : FALSE,
'autoHeight' => $this
->getOption('auto_height') ? TRUE : FALSE,
'startSlide' => (int) $this
->getOption('start_slide'),
'shuffle' => $this
->getOption('shuffle') ? TRUE : FALSE,
'loop' => $this
->getOption('loop') ? TRUE : FALSE,
'autoplay' => $this
->hasAutoPlay() ? TRUE : FALSE,
'slideDistance' => (int) $this
->getOption('slide_distance'),
'keyboard' => $this
->getOption('keyboard') ? TRUE : FALSE,
'fullScreen' => $this
->allowFullScreen() ? TRUE : FALSE,
'updateHash' => $this
->getOption('update_hash') ? TRUE : FALSE,
'waitForLayers' => $this
->getOption('wait_for_layers') ? TRUE : FALSE,
'autoScaleLayers' => $this
->getOption('auto_scale_layers') ? TRUE : FALSE,
];
if ($this
->hasAutoPlay()) {
$optionset['autoplayDelay'] = (int) $this
->getOption('autoplay_delay');
$optionset['autoplayDirection'] = $this
->getOption('autoplay_direction');
$optionset['autoplayOnHover'] = $this
->getOption('autoplay_on_hover');
}
if ($this
->allowFullScreen()) {
$optionset['fadeFullScreen'] = $this
->getOption('fade_full_screen') ? TRUE : FALSE;
}
if ($this
->hasThumbnails()) {
$optionset['thumbnailWidth'] = (int) $this
->getOption('thumbnail_width');
$optionset['thumbnailHeight'] = (int) $this
->getOption('thumbnail_height');
$optionset['thumbnailsPosition'] = $this
->getOption('thumbnail_position');
$optionset['thumbnailPointer'] = $this
->getOption('thumbnail_pointer') ? TRUE : FALSE;
$optionset['thumbnailArrows'] = $this
->getOption('thumbnail_arrows') ? TRUE : FALSE;
if ($optionset['thumbnailArrows']) {
$optionset['fadeThumbnailArrows'] = $this
->getOption('fade_thumbnail_arrows') ? TRUE : FALSE;
}
}
return $optionset;
}