You are here

function field_orbit_field_formatter_settings_form in ZURB Orbit 7.2

Same name and namespace in other branches
  1. 7 field_orbit.module \field_orbit_field_formatter_settings_form()

Implements hook_field_formatter_settings_form().

File

./field_orbit.module, line 62
Implement a orbit formatter for fields.

Code

function field_orbit_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array(
    '#type' => 'fieldset',
    '#title' => t('Orbit settings'),
  );
  $element['animation'] = array(
    '#type' => 'select',
    '#title' => t('Animation'),
    '#default_value' => $settings['animation'],
    '#options' => array(
      'fade' => t('fade'),
      'horizontal-slide' => t('horizontal-slide'),
      'vertical-slide' => t('vertical-slide'),
      'horizontal-push' => t('horizontal-push'),
    ),
  );
  $element['timer_speed'] = array(
    '#type' => 'textfield',
    '#title' => t('Timer speed'),
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
    '#default_value' => $settings['timer_speed'],
  );
  $element['pause_on_hover'] = array(
    '#type' => 'checkbox',
    '#title' => t('Pause on hover'),
    '#default_value' => $settings['pause_on_hover'],
    '#description' => t('Pause slideshow when you hover on the slide.'),
  );
  $element['resume_on_mouseout'] = array(
    '#type' => 'checkbox',
    '#title' => t('Resume on mouseout'),
    '#default_value' => $settings['resume_on_mouseout'],
    '#description' => t('Resume slideshow when you hover off the slide.'),
  );
  $element['animation_speed'] = array(
    '#type' => 'textfield',
    '#title' => t('Animation speed'),
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
    '#default_value' => $settings['animation_speed'],
  );
  $element['stack_on_small'] = array(
    '#type' => 'checkbox',
    '#title' => t('Stack on small'),
    '#default_value' => $settings['stack_on_small'],
    '#description' => t('Stack the slides for small'),
  );
  $element['navigation_arrows'] = array(
    '#type' => 'checkbox',
    '#title' => t('Naviagtion Arrows'),
    '#default_value' => $settings['navigation_arrows'],
    '#description' => t('Hide navigation arrows.'),
  );
  $element['slide_number'] = array(
    '#type' => 'checkbox',
    '#title' => t('Slide Numbers'),
    '#default_value' => $settings['slide_number'],
    '#description' => t('Hide slide numbers.'),
  );
  $element['container_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Container Class'),
    '#default_value' => $settings['container_class'],
  );
  $element['stack_on_small_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Stack on small class'),
    '#default_value' => $settings['stack_on_small_class'],
  );
  $element['next_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Next arrow class'),
    '#default_value' => $settings['next_class'],
  );
  $element['prev_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Previous arrow class'),
    '#default_value' => $settings['prev_class'],
  );
  $element['timer_container_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Timer conatiner class'),
    '#default_value' => $settings['timer_container_class'],
  );
  $element['timer_paused_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Timer paused class'),
    '#default_value' => $settings['timer_paused_class'],
  );
  $element['timer_progress_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Timer progress class'),
    '#default_value' => $settings['timer_progress_class'],
  );
  $element['slides_container_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Slide container class'),
    '#default_value' => $settings['slides_container_class'],
  );
  $element['bullets_container_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Bullets container class'),
    '#default_value' => $settings['bullets_container_class'],
  );
  $element['bullets_active_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Bullets active class'),
    '#default_value' => $settings['bullets_active_class'],
  );
  $element['slide_number_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Slide number class'),
    '#default_value' => $settings['slide_number_class'],
  );
  $element['caption_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Caption class'),
    '#default_value' => $settings['caption_class'],
  );
  $element['active_slide_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Active slide class'),
    '#default_value' => $settings['active_slide_class'],
  );
  $element['orbit_transition_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Orbit transition class'),
    '#default_value' => $settings['orbit_transition_class'],
  );
  $element['bullets'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show Navigational Bullets'),
    '#default_value' => $settings['bullets'],
    '#description' => t('Shows Orbits default navigational bullets below the slideshow.'),
  );
  $element['bulletThumbs'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use custom thumbnails for Bullets'),
    '#default_value' => $settings['bulletThumbs'],
    '#description' => t('Use custom thumbnails for bullets. The image style can be set below. You do not need the "Show navigational bullets" option set for this to work.'),
  );
  $element['timer'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide Timer'),
    '#default_value' => $settings['timer'],
    '#description' => t('Hides the timer.'),
  );
  $element['variable_height'] = array(
    '#type' => 'checkbox',
    '#title' => t('Variable height'),
    '#default_value' => $settings['variable_height'],
    '#description' => t('Show variable height.'),
  );
  $element['orbit_image_style'] = array(
    '#title' => t('Image style'),
    '#type' => 'select',
    '#default_value' => $settings['orbit_image_style'],
    '#empty_option' => t('None (original image)'),
    '#options' => image_style_options(FALSE),
  );
  $element['orbit_bullet_thumbs'] = array(
    '#title' => t('Orbit bullets thumbnails image style'),
    '#description' => t('If set, Orbit will show bullet thumbnails instead of the default disc bullets. Select the image style size to apply to the images.'),
    '#type' => 'select',
    '#default_value' => $settings['orbit_bullet_thumbs'],
    '#empty_option' => t('None (use default Orbit bullets)'),
    '#options' => image_style_options(FALSE),
  );
  $links = array();
  if ($field['type'] == 'file' || $field['type'] == 'image') {
    $links += _field_orbit_get_fields(array(
      'link_field',
      'text',
    ), $field['type'], $field['field_name']);
    $element['orbit_link'] = array(
      '#title' => t('Link image to'),
      '#type' => 'select',
      '#default_value' => $settings['orbit_link'],
      '#empty_option' => t('Nothing'),
      '#options' => $links,
    );
  }
  if ($field['type'] == 'file' || $field['type'] == 'image') {
    $text_fields = _field_orbit_get_fields(array(
      'text',
      'text_long',
    ), $field['type'], $field['field_name']);
  }
  if (!isset($text_fields)) {
    $text_fields = array();
  }
  $element['orbit_title'] = array(
    '#title' => t('Title'),
    '#type' => 'select',
    '#default_value' => $settings['orbit_title'],
    '#empty_option' => t('Nothing'),
    '#options' => $text_fields,
  );
  $element['orbit_caption'] = array(
    '#title' => t('Caption'),
    '#type' => 'select',
    '#default_value' => $settings['orbit_caption'],
    '#empty_option' => t('Nothing'),
    '#options' => $text_fields,
  );
  $element['orbit_caption_link'] = array(
    '#title' => t('Caption link'),
    '#type' => 'select',
    '#default_value' => $settings['orbit_caption_link'],
    '#empty_option' => t('Nothing'),
    '#options' => $links,
    '#states' => array(
      'invisible' => array(
        ':input[name$="[settings_edit_form][settings][orbit_caption]"]' => array(
          'value' => '',
        ),
      ),
    ),
  );
  return $element;
}