function ArgumentValidatorTest::validateArgument

Same name and namespace in other branches
  1. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_validator/ArgumentValidatorTest.php \Drupal\views_test_data\Plugin\views\argument_validator\ArgumentValidatorTest::validateArgument()
  2. 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_validator/ArgumentValidatorTest.php \Drupal\views_test_data\Plugin\views\argument_validator\ArgumentValidatorTest::validateArgument()
  3. 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_validator/ArgumentValidatorTest.php \Drupal\views_test_data\Plugin\views\argument_validator\ArgumentValidatorTest::validateArgument()

Performs validation for a given argument.

Overrides ArgumentValidatorPluginBase::validateArgument

File

core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_validator/ArgumentValidatorTest.php, line 42

Class

ArgumentValidatorTest
Defines an argument validator test plugin.

Namespace

Drupal\views_test_data\Plugin\views\argument_validator

Code

public function validateArgument($arg) {
  if ($arg === 'this value should be replaced') {
    // Set the argument to a numeric value so this is valid on PostgreSQL for
    // numeric fields.
    $this->argument->argument = '1';
    return TRUE;
  }
  return $arg == $this->options['test_value'];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.