You are here

function slick_field_formatter_settings_form in Slick Carousel 7

Implements hook_field_formatter_settings_form().

File

./slick.module, line 56
Slick carousel for Drupal.

Code

function slick_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array();
  switch ($field->type) {
    case 'image':
      $image_style_options = image_style_options(FALSE);
      $element['slick_image_style'] = array(
        '#title' => t('Image style'),
        '#type' => 'select',
        '#options' => $image_style_options,
        '#default_value' => $settings['slick_image_style'],
      );
      break;
    case 'field_collection':
      break;
  }

  // Build slick options as form elements.
  $options = slick_get_options();
  foreach ($options as $name => $values) {
    $element[$name] = array(
      '#title' => $values['title'],
      '#description' => $values['description'],
      '#type' => $values['type'] == 'boolean' ? 'checkbox' : 'textfield',
      '#default_value' => $settings[$name],
    );
  }
  return $element;
}