1 views_handler_field_math.inc views_handler_field_math::options_form(&$form, &$form_state)

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

Overrides views_handler_field_numeric::options_form

File

core/modules/views/handlers/views_handler_field_math.inc, line 25
Definition of views_handler_field_math.

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 <code>2 + 2</code> or <code>sqrt(5)</code>. You may assign variables and create mathematical functions and evaluate them. Use the <code>;</code> to separate these. For example: <code>f(x) = x + 2; f(2)</code>. The result of the mathematical expression of the previous row can be accessed by using the <code>[expression]</code> token itself."),
    '#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']['#states']);
  unset($form['alter']['help']);
}