You are here

function casetracker_views_handler_field_case_count::options_form in Case Tracker 7

Same name and namespace in other branches
  1. 6 includes/casetracker_views_handler_field_case_count.inc \casetracker_views_handler_field_case_count::options_form()

Default options form provides the label widget that all fields should have.

Overrides views_handler_field::options_form

File

includes/casetracker_views_handler_field_case_count.inc, line 23

Class

casetracker_views_handler_field_case_count
Field handler to show case counts for projects.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $options = array(
    0 => t('All cases'),
    t('Priority') => array(),
    t('Status') => array(),
    t('Type') => array(),
  );
  $realms = array(
    'priority' => t('Priority'),
    'status' => t('Status'),
    'type' => t('Type'),
  );
  foreach ($realms as $realm => $realm_name) {
    foreach (casetracker_realm_load($realm) as $csid => $name) {

      // @TODO: this is a user-configured string -- should not be wrapped in t().
      $options[$realm_name]["{$realm}-{$csid}"] = t($name);
    }
  }
  $form['type'] = array(
    '#type' => 'select',
    '#title' => t('Count for type'),
    '#options' => $options,
    '#default_value' => $this->options['type'],
    '#description' => t('Text to put after the number, such as currency symbol.'),
  );
}