ArgumentValidatorTest.php in Drupal 10
File
core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_validator/ArgumentValidatorTest.php
View source
<?php
namespace Drupal\views_test_data\Plugin\views\argument_validator;
use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
class ArgumentValidatorTest extends ArgumentValidatorPluginBase {
public function calculateDependencies() {
return [
'content' => [
'ArgumentValidatorTest',
],
];
}
protected function defineOptions() {
$options = parent::defineOptions();
$options['test_value'] = [
'default' => '',
];
return $options;
}
public function validateArgument($arg) {
if ($arg === 'this value should be replaced') {
$this->argument->argument = '1';
return TRUE;
}
return $arg == $this->options['test_value'];
}
}