You are here

function radioactivity_field_instance_settings_form in Radioactivity 7.2

Implements hook_field_instance_settings_form()

File

./radioactivity.field.inc, line 39

Code

function radioactivity_field_instance_settings_form($field, $instance) {
  $settings = $instance['settings'];
  $form = array();
  if ($field['type'] == RADIOACTIVITY_FIELD_TYPE) {
    $profiles = radioactivity_get_decay_profile_options_list();
    $form['profile'] = array(
      '#type' => 'select',
      '#title' => t('Decay profile'),
      '#default_value' => $settings['profile'],
      '#required' => TRUE,
      '#description' => t('Select the decay profile for this instance. You can create and edit decay profiles !here.', array(
        "!here" => l("here", "admin/structure/radioactivity/profiles"),
      )),
      '#options' => $profiles,
    );
    $form['history'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable history'),
      '#default_value' => isset($settings['history']) ? $settings['history'] : 0,
      '#description' => t('Enable history tracking for this field instance. You can view the history on the edit page or by changing the fields display type.'),
    );
    $form['history_limit'] = array(
      '#type' => 'textfield',
      '#title' => t('History limit'),
      '#default_value' => isset($settings['history_limit']) ? $settings['history_limit'] : 8,
      '#description' => t('For how many hours do you want to store the data for?'),
    );
    if (isset($profiles['none'])) {
      $form['profile']['#disabled'] = TRUE;
      $form['profile']['#description'] = t('It seems that you have not created any profiles yet. You can create and edit decay profiles !here.', array(
        "!here" => l("here", "admin/structure/radioactivity/profiles"),
      ));
    }
  }
  return $form;
}