You are here

function views_handler_field_math::options_form in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 handlers/views_handler_field_math.inc \views_handler_field_math::options_form()
  2. 7.3 handlers/views_handler_field_math.inc \views_handler_field_math::options_form()

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

Overrides views_handler_field_numeric::options_form

File

handlers/views_handler_field_math.inc, line 19

Class

views_handler_field_math
Render a mathematical expression as a numeric value

Code

function options_form(&$form, &$form_state) {
  $form['expression'] = array(
    '#type' => 'textarea',
    '#title' => t('Expression'),
    '#description' => t('Enter mathematical expressions such as 2 + 2 or sqrt(5). You may assign variables and create mathematical functions and evaluate them. Use the ; to separate these. For example: f(x) = x + 2; f(2).'),
    '#default_value' => $this->options['expression'],
  );

  // Create a place for the help
  $form['expression_help'] = array();
  parent::options_form($form, $form_state);

  // Then move the existing help:
  $form['expression_help'] = $form['alter']['help'];
  unset($form['expression_help']['#dependency']);
  unset($form['expression_help']['#process']);
  unset($form['alter']['help']);
}