You are here

public function GoogleAnalyticsBase::buildOptionsForm in Google Analytics Reports 8.3

Provide the basic form which calls through to subforms. If overridden, it is best to call through to the parent, or to at least make sure all of the functions in this form are called.

Overrides FilterPluginBase::buildOptionsForm

File

src/Plugin/views/filter/GoogleAnalyticsBase.php, line 57

Class

GoogleAnalyticsBase
Provides base filter functionality for Google Analytics fields.

Namespace

Drupal\google_analytics_reports\Plugin\views\filter

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $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',
      ],
    ];
  }
}