You are here

function radioactivity_field_settings_form in Radioactivity 7

Implements hook_field_settings_form().

File

./radioactivity.field.inc, line 29

Code

function radioactivity_field_settings_form($field, $instance, $has_data) {
  $settings = $field['settings'];
  $form = array();
  if ($field['type'] == RADIOACTIVITY_FIELD_TYPE) {
    $form['decay_granularity'] = array(
      '#type' => 'textfield',
      '#title' => t('Decay granularity'),
      '#default_value' => $settings['decay_granularity'],
      '#required' => TRUE,
      '#description' => t('This setting determines how often at most the radioactivity is decreased by the decay formula. ' . 'The shorter the time, the more accurate the modeling will be, but the more database ' . 'activity is required. The default (1 minute) should be a good starting point.'),
      '#element_validate' => array(
        '_element_validate_integer_positive',
      ),
      '#disabled' => false,
    );
    $form['half_life'] = array(
      '#type' => 'textfield',
      '#title' => t('Half life'),
      '#default_value' => $settings['half_life'],
      '#required' => TRUE,
      '#description' => t('Determines the decay rate of the radioactivity. For exaple, if the decay rate is ' . '3600 (one hour), the radioactivity halves once an hour. If it is now 1000, it will ' . 'be 500 after an hour, 250 after two hours, and so on. The default is 6 hours.'),
      '#element_validate' => array(
        '_element_validate_integer_positive',
      ),
      '#disabled' => false,
    );
    $form['incident_energy'] = array(
      '#type' => 'textfield',
      '#title' => t('View incident energy'),
      '#default_value' => $settings['incident_energy'],
      '#required' => TRUE,
      '#description' => t('Defines the energy emitted by viewing this field.'),
      '#element_validate' => array(
        '_element_validate_number',
      ),
      '#disabled' => false,
    );
    $form['cut_off'] = array(
      '#type' => 'textfield',
      '#title' => t('Energy cut off'),
      '#default_value' => $settings['cut_off'],
      '#required' => TRUE,
      '#description' => t('Defines the energy lever under which the energy is assumed nonexistent.'),
      '#element_validate' => array(
        '_element_validate_number',
      ),
    );
    $form['storage'] = array(
      '#type' => 'select',
      '#title' => t('Incident storage'),
      '#default_value' => $settings['storage'],
      '#required' => TRUE,
      '#description' => t('Select the storage where all of the incidents are stored before processing them.'),
      '#options' => array(
        'live' => 'Live storage - write directly to the field database.',
        'deferred' => 'Deferred storage - write to a database table for scheduled processing.',
      ),
    );
  }
  return $form;
}