You are here

function slide_with_style_field_widget_settings_form in Select with Style 7

Implements hook_field_widget_settings_form().

File

slide_with_style/slide_with_style.module, line 201
Defines a slider RANGE widget to create filters for numeric and list fields.

Code

function slide_with_style_field_widget_settings_form($field, $instance) {
  $settings = $instance['widget']['settings'];
  switch ($instance['widget']['type']) {
    case 'slide_with_style_slider':
      $form['appearance'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Slider appearance'),
        '#default_value' => $settings['appearance'],
        '#options' => array(
          'with_textfield' => t('with synchronised text field'),
          'with_bubble' => t('with value bubble'),
          'vertical' => t('vertical instead of horizontal'),
        ),
      );
      if ($field['module'] == 'number') {
        $form['step'] = array(
          '#type' => 'textfield',
          '#title' => t('Step'),
          '#default_value' => $settings['step'],
          '#description' => t('The increment that the slider should snap to.'),
          '#element_validate' => array(
            '_element_validate_number',
          ),
          '#required' => TRUE,
        );
      }
      $options = array(
        '' => 'core (no styling)',
      );
      foreach (slide_with_style_css_files() as $name => $filespec) {
        $options[$name] = $name;
      }
      $form['css file'] = array(
        '#type' => 'select',
        '#multiple' => FALSE,
        '#size' => 1,
        '#title' => t('Additional slider styling file'),
        '#default_value' => $settings['css file'],
        '#options' => $options,
        '#description' => t('The directory where the above files are looked up may be changed on the Slide with Style <a href="@href">configuraton page</a>.', array(
          '@href' => url('admin/config/system/slide_with_style'),
        )),
      );
      break;
  }
  return $form;
}