You are here

protected function SimpleMathField::defineOptions in Views Simple Math Field 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/field/SimpleMathField.php \Drupal\views_simple_math_field\Plugin\views\field\SimpleMathField::defineOptions()

Information about options for all kinds of purposes will be held here.


'option_name' => array(
 - 'default' => default value,
 - 'contains' => (optional) array of items this contains, with its own
     defaults, etc. If contains is set, the default will be ignored and
     assumed to be array().
 ),

Return value

array Returns the options of this handler/plugin.

Overrides NumericField::defineOptions

File

src/Plugin/views/field/SimpleMathField.php, line 49
Defines Drupal\views_simple_math_field\Plugin\views\field\SimpleMathField.

Class

SimpleMathField
Field handler to complete mathematical operation.

Namespace

Drupal\views_simple_math_field\Plugin\views\field

Code

protected function defineOptions() {
  $options = parent::defineOptions();

  // Give this field and alias
  $this->field_alias = 'field_views_simple_math_field';
  $options['fieldset_one']['default'] = NULL;
  $options['fieldset_two']['default'] = NULL;
  $options['fieldset_one']['data_field_one'] = [
    'default' => NULL,
  ];
  $options['fieldset_two']['data_field_two'] = [
    'default' => NULL,
  ];
  $options['operation'] = [
    'default' => NULL,
  ];
  $options['fieldset_one']['constant_one'] = [
    'default' => NULL,
  ];
  $options['fieldset_two']['constant_two'] = [
    'default' => NULL,
  ];
  $options['percentage'] = [
    'default' => NULL,
  ];
  return $options;
}