You are here

public function views_handler_field_math::options_form in Views (for Drupal 7) 7.3

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

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

Overrides views_handler_field_numeric::options_form

File

handlers/views_handler_field_math.inc, line 32
Definition of views_handler_field_math.

Class

views_handler_field_math
Render a mathematical expression as a numeric value

Code

public 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). The result of the previous row's mathematical expression can be accessed by using the [expression] 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']['#dependency']);
  unset($form['alter']['help']);
}