You are here

function _range_field_formatter_base_settings_form in Range 7

Helper function. Adds formatter base settings to the form element.

Parameters

array $element: Form element.

array $settings: Field formatter settings.

1 call to _range_field_formatter_base_settings_form()
range_field_formatter_settings_form in ./range.module
Implements hook_field_formatter_settings_form().

File

./range.module, line 371
Defines range field types.

Code

function _range_field_formatter_base_settings_form(array &$element, array $settings, $field_name) {
  $element['range_separator'] = array(
    '#type' => 'textfield',
    '#title' => t('Range separator'),
    '#default_value' => $settings['range_separator'],
  );
  $element['range_combine'] = array(
    '#type' => 'checkbox',
    '#title' => t('Combine equivalent values'),
    '#description' => t('If the FROM and TO values are equal, combine the display into a single value.'),
    '#default_value' => $settings['range_combine'],
  );
  $element['from_prefix_suffix'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display <em>FROM value</em> prefix and suffix'),
    '#default_value' => $settings['from_prefix_suffix'],
  );
  $element['to_prefix_suffix'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display <em>TO value</em> prefix and suffix'),
    '#default_value' => $settings['to_prefix_suffix'],
  );
  $element['field_prefix_suffix'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display <em>FIELD value</em> prefix and suffix'),
    '#default_value' => $settings['field_prefix_suffix'],
  );
  $element['combined_prefix_suffix'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display <em>COMBINED value</em> prefix and suffix'),
    '#default_value' => $settings['combined_prefix_suffix'],
    '#states' => array(
      'visible' => array(
        ':input[name="fields[' . $field_name . '][settings_edit_form][settings][range_combine]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
}