function _royalslider_typecast_optionset in RoyalSlider Integration 7
Adds the typecasting to the values so that the generated json array keeps the right values
4 calls to _royalslider_typecast_optionset()
- royalslider_optionset_load in ./
royalslider.module - Fetches the given option set and returns it as an object or NULL, if no set could be found.
- royalslider_optionset_load_all in ./
royalslider.module - Fetches all option sets from the database and returns them as an associative array.
- royalslider_optionset_save in ./
royalslider.module - Saves the given optionset to the database. Set the $new flag if this optionset has not been written before.
- _royalslider_optionset_defaults in ./
royalslider.module - Default settings for a newly created option set
File
- ./
royalslider.module, line 420 - RoyalSlider module.
Code
function _royalslider_typecast_optionset(&$options) {
if (isset($options) && !empty($options)) {
foreach ($options as $key => $value) {
switch ($key) {
case 'slidesOrientation':
case 'controlNavigation':
case 'transitionType':
case 'easeInOut':
case 'easeOut':
case 'imageScaleMode':
$options[$key] = (string) $value;
break;
case 'numImagesToPreload':
case 'transitionSpeed':
case 'autoScaleSliderWidth':
case 'autoScaleSliderHeight':
case 'imageScalePadding':
case 'slidesSpacing':
$options[$key] = (int) $value;
break;
case 'manuallyInit':
case 'loop':
case 'loopRewind':
case 'randomizeSlides':
case 'usePreloader':
case 'globalCaption':
case 'controlsInside':
case 'sliderDrag':
case 'sliderTouch':
case 'keyboardNavEnabled':
case 'navigateByClick':
case 'arrowsNav':
case 'arrowsNavAutoHide':
case 'arrowsNavHideOnTouch':
case 'allowCSS3':
case 'addActiveClass':
case 'fadeinLoadedSlide':
case 'autoScaleSlider':
case 'autoHeight':
case 'imageAlignCenter':
case 'drupalAutoSetSliderDimensions':
case 'drupalAutoSetImageDimensions':
$options[$key] = (bool) $value;
break;
case 'imgWidth':
case 'imgHeight':
$options[$key] = empty($value) ? NULL : $value;
break;
case 'fullscreen':
foreach ($value as $k => $v) {
switch ($k) {
case 'enabled':
case 'keyboardNav':
case 'buttonFS':
case 'nativeFS':
$options['fullscreen'][$k] = (bool) $v;
break;
}
}
break;
case 'thumbs':
foreach ($value as $k => $v) {
switch ($k) {
case 'orientation':
$options['thumbs'][$k] = (string) $v;
break;
case 'spacing':
case 'transitionSpeed':
$options['thumbs'][$k] = (int) $v;
break;
case 'drag':
case 'touch':
case 'arrows':
case 'arrowsAutoHide':
case 'autoCenter':
case 'fitInViewport':
case 'firstMargin':
case 'appendSpan':
$options['thumbs'][$k] = (bool) $v;
break;
case 'arrowLeft':
case 'arrowRight':
$options['thumbs'][$k] = empty($v) ? NULL : $v;
break;
}
}
break;
case 'autoplay':
foreach ($value as $k => $v) {
switch ($k) {
case 'enabled':
case 'stopAtAction':
case 'pauseOnHover':
$options['autoplay'][$k] = (bool) $v;
break;
case 'delay':
$options['autoplay'][$k] = (int) $v;
break;
}
}
break;
case 'visibleNearby':
foreach ($value as $k => $v) {
switch ($k) {
case 'enabled':
case 'center':
case 'navigateByCenterClick':
$options['visibleNearby'][$k] = (bool) $v;
break;
case 'centerArea':
case 'breakpoint':
case 'breakpointCenterArea':
$options['visibleNearby'][$k] = (double) $v;
break;
}
}
break;
case 'deeplinking':
foreach ($value as $k => $v) {
switch ($k) {
case 'enabled':
case 'change':
$options['deeplinking'][$k] = (bool) $v;
break;
case 'prefix':
$options['deeplinking'][$k] = (string) $v;
break;
}
}
break;
case 'video':
foreach ($value as $k => $v) {
switch ($k) {
case 'autoHideArrows':
case 'autoHideControlNav':
case 'autoHideBlocks':
$options['video'][$k] = (bool) $v;
break;
case 'youTubeCode':
case 'vimeoCode':
$options['video'][$k] = (string) $v;
break;
}
}
break;
}
}
}
}