You are here

function _flexslider_typecast_optionset in Flex Slider 7.2

Adds the typecasting to the values so that the generated json array keeps the right values

4 calls to _flexslider_typecast_optionset()
flexslider_optionset_load in ./flexslider.module
Fetches the given option set and returns it as an object or NULL, if no set could be found.
flexslider_optionset_load_all in ./flexslider.module
Fetches all option sets from the database and returns them as an associative array.
flexslider_optionset_save in ./flexslider.module
Saves the given option set to the database. Set the $new flag if this set has not been written before.
_flexslider_optionset_defaults in ./flexslider.module
Default settings for a newly created option set

File

./flexslider.module, line 506
A light-weight, customizable image gallery plugin for Drupal based on jQuery

Code

function _flexslider_typecast_optionset(&$options) {
  if (isset($options) && !empty($options)) {
    foreach ($options as $key => $value) {
      switch ($key) {
        case 'namespace':
        case 'selector':
        case 'easing':
        case 'direction':
        case 'controlsContainer':
        case 'sync':
        case 'asNavFor':
        case 'fade':
        case 'prevText':
        case 'nextText':
        case 'pauseText':
        case 'playText':
        case 'manualControls':
          $options[$key] = (string) $value;
          break;
        case 'startAt':
        case 'animationSpeed':
        case 'initDelay':
        case 'itemWidth':
        case 'itemMargin':
        case 'minItems':
        case 'maxItems':
        case 'move':
          $options[$key] = (int) $value;
          break;
        case 'controlNav':
          if ($value == 'thumbnails') {
            $options[$key] = (string) $value;
            break;
          }
        case 'reverse':
        case 'smoothHeight':
        case 'useCSS':
        case 'touch':
        case 'video':
        case 'keyboard':
        case 'multipleKeyboard':
        case 'mouseWheel':
        case 'slideshow':
        case 'directionNav':
        case 'pausePlay':
        case 'randomize':
        case 'thumbCaptions':
        case 'thumbCaptionsBoth':
        case 'animationLoop':
        case 'pauseOnAction':
        case 'pauseOnHover':
          $options[$key] = (bool) $value;
          break;
      }
    }
  }
}