You are here

function radioactivity_field_formatter_settings_form in Radioactivity 7.2

Implements hook_field_instance_settings_form().

File

./radioactivity.field.inc, line 260

Code

function radioactivity_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $form = array();
  if ($field['type'] == RADIOACTIVITY_FIELD_TYPE) {
    switch ($display['type']) {
      case RADIOACTIVITY_COMBO_FORMATTER:
        $form['energy'] = array(
          '#type' => 'textfield',
          '#title' => t('View incident energy'),
          '#default_value' => $settings['energy'],
          '#required' => TRUE,
          '#description' => t('Defines the energy emitted by viewing this field. Set to 0 to disable emit.'),
          '#element_validate' => array(
            '_element_validate_number',
          ),
        );
        $form['type'] = array(
          '#type' => 'select',
          '#title' => t('Type'),
          '#default_value' => $settings['type'],
          '#options' => radioactivity_combo_field_types(),
          '#required' => TRUE,
        );
        $form['accuracy'] = array(
          '#type' => 'textfield',
          '#title' => t('Accuracy'),
          '#default_value' => $settings['accuracy'],
          '#required' => TRUE,
          '#element_validate' => array(
            '_element_validate_number',
          ),
          '#description' => t('Value from 1 to 100 describing the statistic accuracy of this emitter. If value of 80 is given then 80% of field views trigger an emit. Actual energy of this emitter is then corrected by shifting the amount of energy emitted e.g. if incident energy is 10 and accuracy 80, the actual amount of energy emitted per view is 10 / 80 * 100.'),
        );
        break;
    }
  }
  return $form;
}