You are here

function slick_get_elements in Slick Carousel 7.2

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

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

1 call to slick_get_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 763
Contains optional functions called only if needed by admin pages.

Code

function slick_get_elements(array &$elements, $settings, &$form_state) {
  $elements['mousewheel'] = array(
    '#type' => 'checkbox',
    '#title' => t('Mousewheel'),
    '#description' => t('Be sure to download the <a href="@url" target="_blank">mousewheel</a> library, and it is available at <em>sites/.../libraries/mousewheel/jquery.mousewheel.min.js</em>.', array(
      '@url' => '//github.com/brandonaaron/jquery-mousewheel',
    )),
    '#weight' => 96,
  );
  $a = array(
    300,
    600,
    900,
    1800,
    2700,
    3600,
    10800,
    21600,
    32400,
    43200,
    86400,
  );
  $period = drupal_map_assoc($a, 'format_interval');
  $elements['cache'] = array(
    '#type' => 'select',
    '#title' => t('Cache'),
    '#options' => $period + array(
      'persistent' => t('Persistent'),
    ),
    '#weight' => 97,
    '#description' => t('Ditch all slick logic to cached bare HTML. <ol><li><strong>Persistent</strong>: cached contents will persist (be displayed) till the next cron runs.</li><li><strong>Any number</strong>: expired by the selected expiration time, and fresh contents are fetched till the next cache rebuilt.</li></ol>A working cron job is required to clear stale cache. At any rate, cached contents will be refreshed regardless of the expiration time after the cron hits.<br /><strong>Warning!</strong> Be sure no useless/ sensitive data such as Edit links as they are rendered as is regardless permissions. No permissions are changed, just ugly. Note: Slick is already faster, lighter and less memory than <a href="@similar" target="_blank">similar</a> <a href="@url" target="_blank">solutions</a> for anonymous users with just Drupal cache. This is more useful for authenticated traffic, best with Authcache. Only enable it when all is done, otherwise cached options will be displayed while changing them. Leave empty to disable caching, or if traffics are mostly anonymous.', array(
      '@similar' => 'https://www.drupal.org/node/2313461#comment-10817842',
      '@url' => 'https://www.drupal.org/node/2463305#comment-10850288',
    )),
  );

  // Re-uses one optionset for various displays.
  $elements['override'] = array(
    '#title' => t('Override main optionset'),
    '#type' => 'checkbox',
    '#description' => t('If checked, the following options will override the main optionset. Useful to re-use one optionset for several different displays.'),
    '#weight' => 98,
  );
  $overridable_options = slick_get_overridable_options();
  $overridable_values = is_array($settings['overridables']) ? array_values($settings['overridables']) : $settings['overridables'];
  $elements['overridables'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Overridable options'),
    '#description' => t("Override the main optionset to re-use one. Anything dictated here will override the current main optionset. Unchecked means FALSE"),
    '#options' => $overridable_options,
    '#default_value' => $overridable_values,
    '#weight' => 99,
    '#states' => array(
      'visible' => array(
        ':input[name$="[override]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  drupal_alter('slick_elements_info', $elements, $settings, $form_state);
}