You are here

public function GoogleAnalyticsArgument::buildOptionsForm in Google Analytics Reports 8.3

Provide a form to edit options for this plugin.

Overrides ArgumentPluginBase::buildOptionsForm

File

src/Plugin/views/argument/GoogleAnalyticsArgument.php, line 61

Class

GoogleAnalyticsArgument
Provides base argument functionality for Google Analytics fields.

Namespace

Drupal\google_analytics_reports\Plugin\views\argument

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',
      ],
    ];
  }
}