You are here

public function CumulativeField::buildOptionsForm in Views Cumulative Field 8

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

Overrides NumericField::buildOptionsForm

File

src/Plugin/views/field/CumulativeField.php, line 62
Defines Drupal\views_cumulative_field\Plugin\views\field\CumulativeField.

Class

CumulativeField
Field handler to flag the node type.

Namespace

Drupal\views_cumulative_field\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $field_options = $this->displayHandler
    ->getFieldLabels();
  unset($field_options['field_cumulative_field']);
  $form['data_field'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Data Field'),
    '#options' => $field_options,
    '#default_value' => $this->options['data_field'],
    '#description' => $this
      ->t('Select the field for which to calculate the cumulative value.'),
    '#weight' => -10,
  ];
  return $form;
}