Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / views / src / Plugin / views / argument_validator / NumericArgumentValidator.php
1 <?php
2
3 namespace Drupal\views\Plugin\views\argument_validator;
4
5 use Drupal\Core\Plugin\Context\ContextDefinition;
6
7 /**
8  * Validate whether an argument is numeric or not.
9  *
10  * @ingroup views_argument_validate_plugins
11  *
12  * @ViewsArgumentValidator(
13  *   id = "numeric",
14  *   title = @Translation("Numeric")
15  * )
16  */
17 class NumericArgumentValidator extends ArgumentValidatorPluginBase {
18
19   public function validateArgument($argument) {
20     return is_numeric($argument);
21   }
22
23   /**
24    * {@inheritdoc}
25    */
26   public function getContextDefinition() {
27     return new ContextDefinition('integer', $this->argument->adminLabel(), FALSE);
28   }
29
30 }