You are here

function galleria_option_elements in Galleria 7

This function returns an array defining the form elements used to edit the different options.

2 calls to galleria_option_elements()
galleria_form_optionset_edit in includes/galleria.admin.inc
Form builder; Form to edit a given option set.
galleria_option_element in includes/galleria.admin.inc
Returns the form element to use to edit the given option.

File

includes/galleria.admin.inc, line 127
Administrative page callbacks for the galleria module.

Code

function galleria_option_elements() {
  $cropOptions = array(
    'true' => t('Crop the image.'),
    'false' => t('Scale down so the entire image fits.'),
    'height' => t('Scale the image to fill the height of the stage.'),
    'width' => t('Scale the image to fill the width of the stage.'),
    'landscape' => t('Fill up images with landscape proportions; scale portrait images to fit.'),
    'portrait' => t('Fill up images with portrait proportions; scale landscape images to fit.'),
  );
  $transitionOptions = array(
    'fade' => t('fade: crossfade betweens images'),
    'flash' => t('flash: fades into background color between images'),
    'pulse' => t('pulse: quickly removes the image into background color, then fades the next image'),
    'slide' => t('slide: slides the images depending on image position'),
    'fadeslide' => t('fadeslide: fade between images and slide slightly at the same time'),
  );
  return array(
    'autoplay' => array(
      '#type' => 'textfield',
      '#title' => t('Autoplay'),
      '#description' => t('Sets Galleria to play slidehow when initialized. Value in milliseconds, for example 5000 will move forward every 5 seconds. 0 will disable autoplay'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 0,
    ),
    'carousel' => array(
      '#type' => 'checkbox',
      '#title' => t('Thumbnail carousel'),
      '#description' => t('Galleria comes with a built-in horizontal carousel. Activating this, the carousel will be automatically applied if the total sum of thumbnails width exceeds the thumbnail container. This will be re-calculated on resize.'),
      '#default_value' => TRUE,
    ),
    'carouselFollow' => array(
      '#type' => 'checkbox',
      '#title' => t('Carousel follows active image'),
      '#description' => t('This option defines if the the carousel should follow the active image. You can control the speed of the animation with the carouselSpeed option. Please note that animating heavy thumbnails can affect your main image animation, so if you are seeing big lags in the main animation you can try to disable this option.'),
      '#default_value' => TRUE,
    ),
    'carouselSpeed' => array(
      '#type' => 'textfield',
      '#title' => t('Carousel speed'),
      '#description' => t('This option controls the slide speed of the carousel in milliseconds. It globally affects the carousel animation, both when following and sliding.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 200,
    ),
    'carouselSteps' => array(
      '#type' => 'textfield',
      '#title' => t('Carousel steps'),
      '#description' => t('The number of "steps" the carousel will advance when navigating between available thumbnails. "auto" will move the carousel as many steps as there are visible thumbnails.'),
      '#element_validate' => array(
        '_galleria_validate_integer_auto',
      ),
      '#default_value' => 'auto',
    ),
    'clicknext' => array(
      '#type' => 'checkbox',
      '#title' => t('Click for next image'),
      '#description' => t('This options adds a click event over the stage that navigates to the next image in the gallery. Useful for mobile browsers and other simpler applications.'),
      '#default_value' => FALSE,
    ),
    // 'dailymotion' => array(),
    // 'dataConfig' => array(),
    // 'dataSelector' => array(),
    // 'dataSource' => array(),
    'debug' => array(
      '#type' => 'checkbox',
      '#title' => t('Debug'),
      '#description' => t('This option is for turning debug on/off. By default, Galleria displays errors by printing them out in the gallery container and sometimes throw exceptions. For deployment you can turn debug off to generate a more generic error message if a fatal error is raised.'),
      '#default_value' => TRUE,
    ),
    'dummy' => array(
      '#type' => 'textfield',
      '#title' => t('Dummy image'),
      '#description' => t('This option allows you to define an image that should be shown if Galleria can\'t find the original image. Think of it as a 404 for Galleria.'),
      '#default_value' => '',
    ),
    // 'easing' => array(),
    // 'extend' => array(),
    'fullscreenCrop' => array(
      '#type' => 'select',
      '#title' => t('Fullscreen cropping'),
      '#description' => t('Sets how Galleria should crop when in fullscreen mode.'),
      '#options' => $cropOptions,
      '#default_value' => 'false',
    ),
    'fullscreenDoubleTap' => array(
      '#type' => 'checkbox',
      '#title' => t('Fullscreen on double-tap'),
      '#description' => t('This options listens for the double-tap event on touch devices and toggles fullscreen mode if it happens.'),
      '#default_value' => TRUE,
    ),
    'fullscreenTransition' => array(
      '#type' => 'select',
      '#title' => t('Fullscreen transition'),
      '#description' => t('Defines a different transition for fullscreen mode. Some transitions are less smooth in fullscreen mode, this option allows you to set a different transition when in fullscreen mode. See the transition option for info about the different transitions.'),
      '#options' => $transitionOptions,
      '#default_value' => 'fade',
    ),
    'height' => array(
      '#type' => 'textfield',
      '#title' => t('Height'),
      '#description' => t('Galleria needs a height to work properly. You should set the height using this option. By default, Galleria will try to find the height of the parent container which requires Drupal theme support.'),
      '#element_validate' => array(
        '_galleria_validate_number_auto',
      ),
      '#default_value' => 'auto',
    ),
    'idleMode' => array(
      '#type' => 'checkbox',
      '#title' => t('Idle mode'),
      '#description' => t('Global option for turning on/off idle mode. Each gallery enters idle mode after certain amount of time and themes behave differently when this happens, for example clears the stage from distractions. If you want to prevent idle mode from ever occuring, disable this.'),
      '#default_value' => TRUE,
    ),
    'idleTime' => array(
      '#type' => 'textfield',
      '#title' => t('Idle time'),
      '#description' => t('The time in milliseconds before Galleria falls into Idle mode.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 3000,
    ),
    'idleSpeed' => array(
      '#type' => 'textfield',
      '#title' => t('Idle speed'),
      '#description' => t('The animation speed when falling into and returning from Idle mode in milliseconds.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 200,
    ),
    'imageCrop' => array(
      '#type' => 'select',
      '#title' => t('Image cropping'),
      '#description' => t('Defines how the main image will be cropped inside it’s container.'),
      '#options' => $cropOptions,
      '#default_value' => 'false',
    ),
    'imageMargin' => array(
      '#type' => 'textfield',
      '#title' => t('Image margin'),
      '#description' => t('Since images are scaled to fit the stage container, there might be occasions when you need to apply a margin between the image and stage border. This is what this option is for. The margin is set in pixels.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 0,
    ),
    'imagePan' => array(
      '#type' => 'checkbox',
      '#title' => t('Image pan effect'),
      '#description' => t('Galleria comes with a built-in panning effect. The effect is sometimes useful if you have cropped images and want to let the users pan across the stage to see the entire image.<br />' . 'Enable this to apply a mouse-controlled movement of the image to reveal the cropped parts. This effect is useful if you want to avoid dark areas around the image but still be able to view the entire image.'),
      '#default_value' => FALSE,
    ),
    'imagePanSmoothness' => array(
      '#type' => 'textfield',
      '#title' => t('Image pan smoothness'),
      '#description' => t('This value sets how “smooth” the image pan movement should be when setting image_pan to true. The higher value, the smoother effect but also CPU consuming.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 12,
    ),
    'imagePosition' => array(
      '#type' => 'textfield',
      '#title' => t('Image position'),
      '#description' => t('Positions the main image inside the stage container. Works like the CSS background-position property, for example ‘top right’ or ‘20% 100%’. You can use keywords, percents or pixels. The first value is the horizontal position and the second is the vertical.<br />Read more about positioning at <a href="http://www.w3.org/TR/REC-CSS1/#background-position">http://www.w3.org/TR/REC-CSS1/#background-position'),
      '#default_value' => 'center',
    ),
    'imageTimeout' => array(
      '#type' => 'textfield',
      '#title' => t('Image timeout'),
      '#description' => t('This option defines how long Galleria will try to fetch the images (unless it returns 404) before an exception is thrown. It uses milliseconds, so 30000 is 30 sec.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 30000,
    ),
    'initialTransition' => array(
      '#type' => 'select',
      '#title' => t('Initial transition'),
      '#description' => t('Defines a different transition to show on the first image. For example, if you are using a slide transition, you might want the first image to fade. You can then set this option to ‘fade’.'),
      '#options' => $transitionOptions,
      '#default_value' => 'fade',
    ),
    // 'keepSource' => array(),
    'layerFollow' => array(
      '#type' => 'checkbox',
      '#title' => t('Layer follow'),
      '#description' => t('By default, the layer follows the image size on the stage, even if crop is set. This means that the HTML layer will stretch according to the active image. If you want the layer to fill the stage regardless of cropping settings, set this to false.'),
      '#default_value' => TRUE,
    ),
    'lightbox' => array(
      '#type' => 'checkbox',
      '#title' => t('Lightbox'),
      '#description' => t('When set, a lightbox will open when the user clicks on an image.'),
      '#default_value' => FALSE,
    ),
    'lightboxFadeSpeed' => array(
      '#type' => 'textfield',
      '#title' => t('Lightbox fade speed'),
      '#description' => t('When the lightbox opens, it will animate and fade the images and captions. This value controls how fast they should fade in milliseconds.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 200,
    ),
    'lightboxTransitionSpeed' => array(
      '#type' => 'textfield',
      '#title' => t('Lightbox transition speed'),
      '#description' => t('When the lightbox opens, it will animate the white square before displaying the image. This value controls how fast it should animate in milliseconds.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 300,
    ),
    'maxScaleRatio' => array(
      '#type' => 'textfield',
      '#title' => t('Maximum scale ratio'),
      '#description' => t('Sets the maximum scale ratio for images. For example, if you don’t want Galleria to upscale any images, set this to 1. Removing this option will allow any scaling of the images.'),
      '#element_validate' => array(
        '_galleria_validate_number',
      ),
      '#default_value' => 1,
    ),
    'minScaleRatio' => array(
      '#type' => 'textfield',
      '#title' => t('Minimum scale ratio'),
      '#description' => t('Sets the minimum scale ratio for images. For example, if you don’t want Galleria to downscale any images, set this to 1. Removing this option will allow any scaling of the images.'),
      '#element_validate' => array(
        '_galleria_validate_number',
      ),
      '#default_value' => 1,
    ),
    'overlayBackground' => array(
      '#type' => 'textfield',
      '#title' => t('Lightbox overlay background'),
      '#description' => t('This defines the overlay background color when the lightbox opens.'),
      '#default_value' => '#0b0b0b',
    ),
    'overlayOpacity' => array(
      '#type' => 'textfield',
      '#title' => t('Lightbox overlay opacity'),
      '#description' => t('This sets how much opacity the overlay should have when the lightbox opens.'),
      '#element_validate' => array(
        '_galleria_validate_opacity',
      ),
      '#default_value' => 0.85,
    ),
    'pauseOnInteraction' => array(
      '#type' => 'checkbox',
      '#title' => t('Pause playback on interaction'),
      '#description' => t('During playback, Galleria will stop the playback if the user presses thumbnails or any other navigational links. If you dont want this behaviour, disable this option.'),
      '#default_value' => TRUE,
    ),
    // 'popupLinks' => array(),
    'preload' => array(
      '#type' => 'textfield',
      '#title' => t('Preload images'),
      '#description' => t('Defines how many images Galleria should preload in advance. Please note that this only applies when you are using separate thumbnail files. Galleria always cache all preloaded images.<br />' . '\'2\' preloads the next 2 images in line, \'all\' forces Galleria to start preloading all images. This may slow down client. \'0\' will not preload any images.'),
      '#element_validate' => array(
        '_galleria_validate_preload',
      ),
      '#default_value' => 2,
    ),
    'queue' => array(
      '#type' => 'checkbox',
      '#title' => t('Queue the slideshow'),
      '#description' => t('Galleria queues all activation clicks (next/prev & thumbnails). You can see this effect when f.ex clicking “next” fast many times. If you don’t want Galleria to queue, disable this. This will make Galleria stall during animations.'),
      '#default_value' => TRUE,
    ),
    'responsive' => array(
      '#type' => 'checkbox',
      '#title' => t('Responsive layout'),
      '#description' => t('This option sets the gallery in responsive mode. That means that it will resize the entire container if your CSS is dynamic. In other words, you can add media queries or dynamic proportions in your CSS and the gallery will follow these proportions as the window resizes.'),
      '#default_value' => FALSE,
    ),
    'show' => array(
      '#type' => 'textfield',
      '#title' => t('Show image'),
      '#description' => t('This defines what image index to show at first. If you use the history plugin, a permalink will override this number.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 0,
    ),
    'showCounter' => array(
      '#type' => 'checkbox',
      '#title' => t('Show counter'),
      '#description' => t('Disable this if you do not wish to display the counter.'),
      '#default_value' => TRUE,
    ),
    'showInfo' => array(
      '#type' => 'checkbox',
      '#title' => t('Show info'),
      '#description' => t('Disable this if you do not wish to display the image caption and description.'),
      '#default_value' => TRUE,
    ),
    'showImagenav' => array(
      '#type' => 'checkbox',
      '#title' => t('Show image navigation'),
      '#description' => t('Disable this option if you do not wish to display the image navigation (next/prev arrows).'),
      '#default_value' => TRUE,
    ),
    'swipe' => array(
      '#type' => 'checkbox',
      '#description' => t('Enables a swipe movement for flicking through images on touch devices.'),
      '#default_value' => TRUE,
    ),
    'thumbCrop' => array(
      '#type' => 'select',
      '#title' => t('Thumbnail cropping'),
      '#description' => t('Defines how the thumbnails will be cropped inside their container.'),
      '#options' => $cropOptions,
      '#default_value' => 'true',
    ),
    'thumbFit' => array(
      '#type' => 'checkbox',
      '#title' => t('Fit thumbnails'),
      '#description' => t('If this is enabled, all thumbnail containers will be shrinked to fit the actual thumbnail size. This is useful if you have thumbnails of various sizes and will them float nicely side-by-side.<br />' . 'This is only relevant if thumbCrop is set to anything else but "crop". If you want all thumbnails to fit inside a container with predefined width & height, disable this.'),
      '#default_value' => TRUE,
    ),
    'thumbMargin' => array(
      '#type' => 'textfield',
      '#title' => t('Thumbnail margin'),
      '#description' => t('Specifies the margin between the thumbnails and their container. The margin is set in pixels.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 0,
    ),
    'thumbnails' => array(
      '#type' => 'select',
      '#title' => t('Show Thumbnails'),
      '#description' => t('Sets the creation of thumbnails.'),
      '#options' => array(
        'true' => t('Show thumbnails'),
        'false' => t('No thumbnails'),
        'numbers' => t('Show empty spans with numbers instead of thumbnails'),
        'empty' => t('Show empty spans with the className img instead of thumbnails'),
      ),
      '#default_value' => 'true',
    ),
    'thumbQuality' => array(
      '#type' => 'select',
      '#title' => t('Thumbnail quality in IE'),
      '#description' => t('Defines if and how IE should use bicubic image rendering for thumbnails'),
      '#options' => array(
        'auto' => t('Use high quality if image scaling is moderate'),
        'false' => t('Don´t use high quality (better performance)'),
        'true' => t('Force high quality rendering (can slow down performance)'),
      ),
      '#default_value' => 'true',
    ),
    'touchTransition' => array(
      '#type' => 'select',
      '#title' => t('Touch Transition'),
      '#description' => t('Defines a different transition when a touch device is detected. See the transition option for info about the different transitions.'),
      '#options' => $transitionOptions,
      '#default_value' => 'fade',
    ),
    'transition' => array(
      '#type' => 'select',
      '#title' => t('Transition'),
      '#description' => t('The transition that is used when displaying the images.'),
      '#options' => $transitionOptions,
      '#default_value' => 'fade',
    ),
    'transitionSpeed' => array(
      '#type' => 'textfield',
      '#title' => t('Transition speed'),
      '#description' => t('The milliseconds used in the animation when applying the transition. The higher number, the slower transition.'),
      '#element_validate' => array(
        '_galleria_validate_integer',
      ),
      '#default_value' => 400,
    ),
    'trueFullscreen' => array(
      '#type' => 'checkbox',
      '#description' => t('Galleria supports true fullscreen mode if it is supported by the browser (currently FF10+, Safari 5.1+ and Chrome 15+). That means that it will enter a native OS fullscreen if the fullscreen method is triggered.'),
      '#default_value' => TRUE,
    ),
    // 'vimeo' => array(),
    'wait' => array(
      '#type' => 'textfield',
      '#title' => t('Measurement timeout'),
      '#description' => t('Sets how long Galleria should wait when trying to extract measurements, before throwing an error. Set this to \'true\' for infinity. See <a href="http://galleria.io/docs/options/wait/">the documentation</a> for more details.'),
      '#element_validate' => array(
        '_galleria_validate_integer_boolean',
      ),
      '#default_value' => 5000,
    ),
    'width' => array(
      '#type' => 'textfield',
      '#title' => t('Width'),
      '#description' => t('You should use this option to set a gallery width manually. By default, Galleria fetches the width from the containing element which requires special Drupal theme support.'),
      '#element_validate' => array(
        '_galleria_validate_integer_auto',
      ),
      '#default_value' => 'auto',
    ),
  );
}