You are here

public function Php::buildOptionsForm in PHP 8

Same name in this branch
  1. 8 src/Plugin/views/argument_default/Php.php \Drupal\php\Plugin\views\argument_default\Php::buildOptionsForm()
  2. 8 src/Plugin/views/argument_validator/Php.php \Drupal\php\Plugin\views\argument_validator\Php::buildOptionsForm()

Provides the default form for setting options.

Overrides ArgumentValidatorPluginBase::buildOptionsForm

File

src/Plugin/views/argument_validator/Php.php, line 32

Class

Php
Provide PHP code to validate whether or not an argument is ok.

Namespace

Drupal\php\Plugin\views\argument_validator

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['code'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('PHP validate code'),
    '#default_value' => $this->options['code'],
    '#description' => $this
      ->t('Enter PHP code that returns TRUE or FALSE. No return is the same as FALSE, so be SURE to return something if you do not want to declare the argument invalid. Do not use <?php ?>. The argument to validate will be "$argument" and the view will be "$view". You may change the argument by setting "$handler->argument". You may change the title used for substitutions for this argument by setting "$handler->validated_title".'),
  ];
  $this
    ->checkAccess($form, 'code');
}