You are here

public function GoogleAnalyticsStandard::buildOptionsForm in Google Analytics Reports 8.3

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

Overrides FieldPluginBase::buildOptionsForm

File

src/Plugin/views/field/GoogleAnalyticsStandard.php, line 62

Class

GoogleAnalyticsStandard
Provides base field functionality for Google Analytics fields.

Namespace

Drupal\google_analytics_reports\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  if ($this->isCustom) {
    $form['custom_field_number'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Custom field number'),
      '#default_value' => isset($this->options['custom_field_number']) ? $this->options['custom_field_number'] : 1,
      '#size' => 2,
      '#maxlength' => 2,
      '#required' => TRUE,
      '#element_validate' => [
        Number::class,
        'validateNumber',
      ],
    ];
  }
  parent::buildOptionsForm($form, $form_state);
}