You are here

function flickity_settings in Flickity Carousel 8.2

Same name and namespace in other branches
  1. 8 flickity.module \flickity_settings()
  2. 3.0.x flickity.module \flickity_settings()

Returns Flickity settings group to initialize.

@todo offer breakpoints as child setting groups.

Parameters

$id:

2 calls to flickity_settings()
template_preprocess_flickity in theme/flickity.theme.inc
Template preprocess Flickity variables.
template_preprocess_flickity_entity_view in modules/fields/theme/flickity_fields.theme.inc
Implements template_preprocess_flickity_entity_view().
2 string references to 'flickity_settings'
FlickityEntityView::settingsForm in modules/fields/src/Plugin/Field/FieldFormatter/FlickityEntityView.php
Returns a form to configure settings for the formatter.
FlickityEntityView::viewElements in modules/fields/src/Plugin/Field/FieldFormatter/FlickityEntityView.php
Builds a renderable array for a field value.

File

./flickity.module, line 36
flickity.module

Code

function flickity_settings($id) {
  $config = flickity_load($id);
  $settings = $config
    ->getSettings();
  $group = array(
    'id' => $config
      ->id(),
    'label' => $config
      ->label(),
    'settings' => array(
      'imagesLoaded' => $settings['images_loaded'],
      'cellSelector' => $settings['cell_selector'],
      'initialIndex' => $settings['initial_index'],
      'accessibility' => (bool) $settings['accessibility'],
      'setGallerySize' => (bool) $settings['set_gallery_size'],
      'resize' => (bool) $settings['resize'],
      'cellAlign' => $settings['cell_align'],
      'contain' => (bool) $settings['contain'],
      'percentPosition' => (bool) $settings['percent_position'],
      'rightToLeft' => (bool) $settings['right_to_left'],
      'draggable' => (bool) $settings['draggable'],
      'freeScroll' => (bool) $settings['free_scroll'],
      'wrapAround' => (bool) $settings['wrap_around'],
      'groupCells' => $settings['group_cells'],
      'adaptiveHeight' => $settings['adaptive_height'],
      'lazyLoad' => $settings['lazy_load'],
      'dragThreshold' => $settings['drag_threshold'],
      'autoPlay' => $settings['auto_play'],
      'watchCSS' => (bool) $settings['watch_css'],
      'asNavFor' => $settings['as_nav_for'],
      'selectedAttraction' => $settings['selected_attraction'],
      'friction' => $settings['friction'],
      'freeScrollFriction' => $settings['free_scroll_friction'],
      'prevNextButtons' => (bool) $settings['prev_next_buttons'],
      'pageDots' => (bool) $settings['page_dots'],
    ),
  );

  // Allow alter on group settings.
  \Drupal::moduleHandler()
    ->alter('settings', $group);
  return $group;
}