You are here

public function ArgumentValidatorTest::validateArgument in Drupal 8

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. 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 39

Class

ArgumentValidatorTest
Defines a 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 PostgeSQL for
    // numeric fields.
    $this->argument->argument = '1';
    return TRUE;
  }
  return $arg == $this->options['test_value'];
}