You are here

function slick_get_top_elements in Slick Carousel 7.2

Same name and namespace in other branches
  1. 7.3 includes/slick.admin.inc \slick_get_top_elements()

Returns shared starting form elements across Slick field formatter and Views.

1 call to slick_get_top_elements()
_slick_fields_field_formatter_settings_form in slick_fields/includes/slick_fields.formatters.admin.inc
Off-loaded hook_field_formatter_settings_form().

File

includes/slick.admin.inc, line 454
Contains optional functions called only if needed by admin pages.

Code

function slick_get_top_elements(array &$elements, $settings, &$form_state) {
  $slick_path = drupal_get_path('module', 'slick');
  $optionsets = slick_optionset_options();
  $readme = url($slick_path . '/README.txt');
  $elements['optionset'] = array(
    '#title' => t('Optionset main'),
    '#type' => 'select',
    '#options' => $optionsets,
    '#description' => t('Manage optionsets at <a href="@link" target="_blank">Slick carousel admin page</a>.', array(
      '@link' => url('admin/config/media/slick'),
    )),
  );
  $elements['skin'] = array(
    '#type' => 'select',
    '#title' => t('Skin main'),
    '#options' => slick_get_skins_by_group('main', TRUE),
    '#description' => t('Skins allow swappable layouts like next/prev links, split image and caption, etc. with just CSS. However a combination of skins and options may lead to unpredictable layouts, get yourself dirty. See <a href="@url" target="_blank">SKINS section at README.txt</a> for details on Skins. Leave empty to DIY, or use hook_slick_skins_info() to register ones.', array(
      '@url' => $readme,
    )),
  );
  $elements['optionset_thumbnail'] = array(
    '#title' => t('Optionset thumbnail'),
    '#type' => 'select',
    '#options' => $optionsets,
    '#description' => t('If provided, asNavFor aka thumbnail navigation applies. Leave empty to not use thumbnail navigation.'),
  );
  $elements['skin_thumbnail'] = array(
    '#type' => 'select',
    '#title' => t('Skin thumbnail'),
    '#options' => slick_get_skins_by_group('thumbnail', TRUE),
    '#description' => t('Thumbnail navigation skin. See main <a href="@url" target="_blank">README</a> for details on Skins. Leave empty to not use thumbnail navigation.', array(
      '@url' => $readme,
    )),
  );
  $elements['skin_arrows'] = array(
    '#type' => 'select',
    '#title' => t('Skin arrows'),
    '#options' => array(),
    '#description' => t('Use hook_slick_skins_info() with group propery arrows to add your own arrows skins.'),
    '#access' => FALSE,
  );
  if ($arrows = slick_get_skins_by_group('arrows', TRUE)) {
    $elements['skin_arrows']['#options'] = $arrows;
    $elements['skin_arrows']['#access'] = TRUE;
  }
  $elements['skin_dots'] = array(
    '#type' => 'select',
    '#title' => t('Skin dots'),
    '#options' => array(),
    '#description' => t('Use hook_slick_skins_info() with group propery dots to add your own dots skins.'),
    '#access' => FALSE,
  );
  if ($dots = slick_get_skins_by_group('dots', TRUE)) {
    $elements['skin_dots']['#options'] = $dots;
    $elements['skin_dots']['#access'] = TRUE;
  }
  $weight = -99;
  foreach (element_children($elements) as $key) {
    if (!isset($elements[$key]['#weight'])) {
      $elements[$key]['#weight'] = ++$weight;
    }
  }
}