You are here

public function SlickUi::getSlickElements in Slick Carousel 7.2

Defines a list of form elements available for the Slick.

Return value

array All available Slick form elements.

See also

http://kenwheeler.github.io/slick

2 calls to SlickUi::getSlickElements()
SlickUi::edit_form in slick_ui/plugins/export_ui/SlickUi.class.php
Overrides the actual editing form.
SlickUi::getSlickResponsiveElements in slick_ui/plugins/export_ui/SlickUi.class.php
Defines available options for the responsive Slick.

File

slick_ui/plugins/export_ui/SlickUi.class.php, line 496
Contains the CTools export UI integration code.

Class

SlickUi
CTools Export UI class handler for Slick UI.

Code

public function getSlickElements() {
  $elements =& drupal_static(__METHOD__, NULL);
  if (!isset($elements)) {
    $elements = array();
    $elements['mobileFirst'] = array(
      'title' => t('Mobile first'),
      'description' => t('Responsive settings use mobile first calculation, or equivalent to min-width query.'),
      'type' => 'checkbox',
    );
    $elements['asNavFor'] = array(
      'title' => t('asNavFor target'),
      'description' => t('Leave empty if using sub-modules to have it auto-matched. Set the slider to be the navigation of other slider (Class or ID Name). Use selector identifier ("." or "#") accordingly. See HTML structure section at README.txt for more info. Overriden by field formatter, or Views style.'),
      'type' => 'textfield',
    );
    $elements['accessibility'] = array(
      'title' => t('Accessibility'),
      'description' => t('Enables tabbing and arrow key navigation.'),
      'type' => 'checkbox',
    );
    $elements['adaptiveHeight'] = array(
      'title' => t('Adaptive height'),
      'description' => t('Enables adaptive height for SINGLE slide horizontal carousels. This is useless with variableWidth.'),
      'type' => 'checkbox',
    );
    $elements['autoplay'] = array(
      'title' => t('Autoplay'),
      'description' => t('Enables autoplay.'),
      'type' => 'checkbox',
    );
    $elements['autoplaySpeed'] = array(
      'title' => t('Autoplay speed'),
      'description' => t('Autoplay speed in milliseconds.'),
      'type' => 'textfield',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][autoplay]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['pauseOnHover'] = array(
      'title' => t('Pause on hover'),
      'description' => t('Pause autoplay on hover.'),
      'type' => 'checkbox',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][autoplay]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['pauseOnDotsHover'] = array(
      'title' => t('Pause on dots hover'),
      'description' => t('Pauses autoplay when a dot is hovered.'),
      'type' => 'checkbox',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][autoplay]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['arrows'] = array(
      'title' => t('Arrows'),
      'description' => t('Show prev/next arrows'),
      'type' => 'checkbox',
    );
    $elements['prevArrow'] = array(
      'title' => t('Previous arrow'),
      'description' => t("Customize the previous arrow text."),
      'type' => 'textfield',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][arrows]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['nextArrow'] = array(
      'title' => t('Next arrow'),
      'description' => t("Customize the next arrow text."),
      'type' => 'textfield',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][arrows]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['centerMode'] = array(
      'title' => t('Center mode'),
      'description' => t('Enables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts.'),
      'type' => 'checkbox',
    );
    $elements['centerPadding'] = array(
      'title' => t('Center padding'),
      'description' => t('Side padding when in center mode (px or %). Be aware, too large padding at small breakpoint will screw the slide calculation with slidesToShow.'),
      'type' => 'textfield',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][centerMode]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['dots'] = array(
      'title' => t('Dots'),
      'description' => t('Show dot indicators.'),
      'type' => 'checkbox',
    );
    $elements['dotsClass'] = array(
      'title' => t('Dot class'),
      'description' => t('Class for slide indicator dots container. Do not prefix with dot. If you change this, edit its CSS accordingly.'),
      'type' => 'textfield',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][dots]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['appendDots'] = array(
      'title' => t('Append dots'),
      'description' => t('Change where the navigation dots are attached (Selector, htmlString). If you change this, be sure to provide its relevant markup. Try <strong>.slick__arrow</strong> to achieve this style: <br />&lt; o o o o o o o &gt;<br />Be sure to enable Arrows in such a case.'),
      'type' => 'textfield',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][dots]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['draggable'] = array(
      'title' => t('Draggable'),
      'description' => t('Enable mouse dragging.'),
      'type' => 'checkbox',
    );
    $elements['fade'] = array(
      'title' => t('Fade'),
      'description' => t('Enable fade. Warning! This wants slidesToShow 1. Larger than 1, and Slick may be screwed up.'),
      'type' => 'checkbox',
    );
    $elements['focusOnSelect'] = array(
      'title' => t('Focus on select'),
      'description' => t('Enable focus on selected element (click).'),
      'type' => 'checkbox',
    );
    $elements['infinite'] = array(
      'title' => t('Infinite'),
      'description' => t('Infinite loop sliding.'),
      'type' => 'checkbox',
    );
    $elements['initialSlide'] = array(
      'title' => t('Initial slide'),
      'description' => t('Slide to start on.'),
      'type' => 'textfield',
    );
    $lazies = array(
      'anticipated',
      'ondemand',
      'progressive',
    );
    $elements['lazyLoad'] = array(
      'title' => t('Lazy load'),
      'description' => t("Set lazy loading technique. 'ondemand' will load the image as soon as you slide to it, 'progressive' loads one image after the other when the page loads. 'anticipated' preloads images, and requires Slick 1.6.1+. Note: dummy image is no good for ondemand. If ondemand fails to generate images, try progressive instead. Or use <a href='@url' target='_blank'>imageinfo_cache</a>. To share images for Pinterest, leave empty, otherwise no way to read actual image src.", array(
        '@url' => '//www.drupal.org/project/imageinfo_cache',
      )),
      'type' => 'select',
      'options' => drupal_map_assoc($lazies),
      'empty_option' => t('- None -'),
    );
    if (module_exists('blazy')) {
      $elements['lazyLoad']['options']['blazy'] = 'Blazy';
    }
    $elements['respondTo'] = array(
      'title' => t('Respond to'),
      'description' => t("Width that responsive object responds to. Can be 'window', 'slider' or 'min' (the smaller of the two)."),
      'type' => 'select',
      'options' => drupal_map_assoc(array(
        'window',
        'slider',
        'min',
      )),
    );
    $elements['rtl'] = array(
      'title' => t('RTL'),
      'description' => t("Change the slider's direction to become right-to-left."),
      'type' => 'checkbox',
    );
    $elements['rows'] = array(
      'title' => t('Rows'),
      'description' => t("Setting this to more than 1 initializes grid mode. Use slidesPerRow to set how many slides should be in each row."),
      'type' => 'textfield',
    );
    $elements['slidesPerRow'] = array(
      'title' => t('Slides per row'),
      'description' => t("With grid mode intialized via the rows option, this sets how many slides are in each grid row."),
      'type' => 'textfield',
    );
    $elements['slide'] = array(
      'title' => t('Slide element'),
      'description' => t("Element query to use as slide. Slick will use any direct children as slides, without having to specify which tag or selector to target."),
      'type' => 'textfield',
    );
    $elements['slidesToShow'] = array(
      'title' => t('Slides to show'),
      'description' => t('Number of slides to show at a time. If 1, it will behave like slideshow, more than 1 a carousel. Provide more if it is a thumbnail navigation with asNavFor. Only works with odd number slidesToShow counts when using centerMode (e.g.: 3, 5, 7, etc.). Not-compatible with variableWidth.'),
      'type' => 'textfield',
    );
    $elements['slidesToScroll'] = array(
      'title' => t('Slides to scroll'),
      'description' => t('Number of slides to scroll at a time, or steps at each scroll.'),
      'type' => 'textfield',
    );
    $elements['speed'] = array(
      'title' => t('Speed'),
      'description' => t('Slide/Fade animation speed in milliseconds.'),
      'type' => 'textfield',
      'field_suffix' => 'ms',
    );
    $elements['swipe'] = array(
      'title' => t('Swipe'),
      'description' => t('Enable swiping.'),
      'type' => 'checkbox',
    );
    $elements['swipeToSlide'] = array(
      'title' => t('Swipe to slide'),
      'description' => t('Allow users to drag or swipe directly to a slide irrespective of slidesToScroll.'),
      'type' => 'checkbox',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][swipe]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['edgeFriction'] = array(
      'title' => t('Edge friction'),
      'description' => t("Resistance when swiping edges of non-infinite carousels. If you don't want resistance, set it to 1."),
      'type' => 'textfield',
    );
    $elements['touchMove'] = array(
      'title' => t('Touch move'),
      'description' => t('Enable slide motion with touch.'),
      'type' => 'checkbox',
    );
    $elements['touchThreshold'] = array(
      'title' => t('Touch threshold'),
      'description' => t('Swipe distance threshold.'),
      'type' => 'textfield',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][touchMove]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['useCSS'] = array(
      'title' => t('Use CSS'),
      'description' => t('Enable/disable CSS transitions.'),
      'type' => 'checkbox',
    );
    $elements['cssEase'] = array(
      'title' => t('CSS ease'),
      'description' => t('CSS3 animation easing. <a href="@ceaser">Learn</a> <a href="@bezier">more</a>. Ignored if <strong>CSS ease override</strong> is provided.', array(
        '@ceaser' => '//matthewlein.com/ceaser/',
        '@bezier' => '//cubic-bezier.com',
      )),
      'type' => 'textfield',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][useCSS]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['cssEaseBezier'] = array(
      'type' => 'hidden',
    );
    $elements['cssEaseOverride'] = array(
      'title' => t('CSS ease override'),
      'description' => t('If provided, this will override the CSS ease with the pre-defined CSS easings based on <a href="@ceaser">CSS Easing Animation Tool</a>. Leave it empty to use your own CSS ease.', array(
        '@ceaser' => '//matthewlein.com/ceaser/',
      )),
      'type' => 'select',
      'options' => $this
        ->getCssEasingOptions(),
      'empty_option' => t('- None -'),
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][useCSS]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['useTransform'] = array(
      'title' => t('Use transform'),
      'description' => t('Enable/disable CSS transforms.'),
      'type' => 'checkbox',
    );
    $elements['easing'] = array(
      'title' => t('jQuery easing'),
      'description' => t('Add easing for jQuery animate as fallback. Use with <a href="@easing">easing</a> libraries or default easing methods. This will be ignored and replaced by CSS ease for supporting browsers, or effective if useCSS is disabled.', array(
        '@easing' => '//gsgd.co.uk/sandbox/jquery/easing/',
      )),
      'type' => 'select',
      'options' => $this
        ->getJsEasingOptions(),
      'empty_option' => t('- None -'),
    );
    $elements['variableWidth'] = array(
      'title' => t('variableWidth'),
      'description' => t('Disables automatic slide width calculation. Best with uniform image heights, use scale height image effect. Useless with adaptiveHeight, and non-uniform image heights. Useless with slidesToShow > 1 if the container is smaller than the amount of visible slides. Troubled with lazyLoad ondemand.'),
      'type' => 'checkbox',
    );
    $elements['vertical'] = array(
      'title' => t('Vertical'),
      'description' => t('Vertical slide direction. See <a href="@url" target="_blank">relevant issue</a>.', array(
        '@url' => '//github.com/kenwheeler/slick/issues/1001',
      )),
      'type' => 'checkbox',
    );
    $elements['verticalSwiping'] = array(
      'title' => t('Vertical swiping'),
      'description' => t('Changes swipe direction to vertical.'),
      'type' => 'checkbox',
      'states' => array(
        'visible' => array(
          ':input[name*="options[settings][vertical]"]' => array(
            'checked' => TRUE,
          ),
        ),
      ),
    );
    $elements['waitForAnimate'] = array(
      'title' => t('waitForAnimate'),
      'description' => t('Ignores requests to advance the slide while animating.'),
      'type' => 'checkbox',
    );

    // Defines the default values if available.
    $defaults = slick_get_options();
    foreach ($elements as $name => $element) {
      $default = $element['type'] == 'checkbox' ? FALSE : '';
      $elements[$name]['default'] = isset($defaults[$name]) ? $defaults[$name] : $default;
    }

    // Allows form elements information to be altered.
    drupal_alter('slick_ui_elements_info', $elements);
  }
  return $elements;
}