You are here

function _range_field_instance_subelements_settings_form in Range 7

Helper function. Builds settings fieldsets for the FROM/TO subelements.

Parameters

array $form: Instance settings form definition array.

string $name: Form element machine name.

array $settings: Field instance settings.

1 call to _range_field_instance_subelements_settings_form()
range_field_instance_settings_form in ./range.module
Implements hook_field_instance_settings_form().

File

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

Code

function _range_field_instance_subelements_settings_form(array &$form, $name, array $settings) {
  $form[$name] = array(
    '#type' => 'fieldset',
    '#title' => drupal_ucfirst($name) . ' value',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  if ($name === 'from' || $name === 'to') {
    $form[$name]['label'] = array(
      '#type' => 'textfield',
      '#title' => t('Form element label'),
      '#default_value' => $settings[$name]['label'],
      '#description' => t('Defines label for form element.'),
    );
  }
  $form[$name]['prefix'] = array(
    '#type' => 'textfield',
    '#title' => t('Prefix'),
    '#default_value' => $settings[$name]['prefix'],
    '#size' => 60,
    '#description' => t("Define a string that should be prefixed to the value, like '\$ ' or '€ '. Leave blank for none."),
  );
  $form[$name]['suffix'] = array(
    '#type' => 'textfield',
    '#title' => t('Suffix'),
    '#default_value' => $settings[$name]['suffix'],
    '#size' => 60,
    '#description' => t("Define a string that should be suffixed to the value, like ' m', ' kb/s'. Leave blank for none."),
  );
}