You are here

public function Php::buildOptionsForm in Views (for Drupal 7) 8.3

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

Provide the default form for setting options.

Overrides ArgumentDefaultPluginBase::buildOptionsForm

File

lib/Drupal/views/Plugin/views/argument_default/Php.php, line 32
Definition of Drupal\views\Plugin\views\argument_default\Php.

Class

Php
Default argument plugin to provide a PHP code block.

Namespace

Drupal\views\Plugin\views\argument_default

Code

public function buildOptionsForm(&$form, &$form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['code'] = array(
    '#type' => 'textarea',
    '#title' => t('PHP contextual filter code'),
    '#default_value' => $this->options['code'],
    '#description' => t('Enter PHP code that returns a value to use for this filter. Do not use <?php ?>. You must return only a single value for just this filter. Some variables are available: the view object will be "$view". The argument handler will be "$argument", for example you may change the title used for substitutions for this argument by setting "argument->validated_title"".'),
  );

  // Only do this if using one simple standard form gadget
  $this
    ->check_access($form, 'code');
}