You are here

class NumericArgumentValidator in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/argument_validator/NumericArgumentValidator.php \Drupal\views\Plugin\views\argument_validator\NumericArgumentValidator
  2. 9 core/modules/views/src/Plugin/views/argument_validator/NumericArgumentValidator.php \Drupal\views\Plugin\views\argument_validator\NumericArgumentValidator

Validate whether an argument is numeric or not.

Plugin annotation


@ViewsArgumentValidator(
  id = "numeric",
  title = @Translation("Numeric")
)

Hierarchy

  • class \Drupal\views\Plugin\views\argument_validator\NumericArgumentValidator extends \Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase

Expanded class hierarchy of NumericArgumentValidator

File

core/modules/views/src/Plugin/views/argument_validator/NumericArgumentValidator.php, line 17

Namespace

Drupal\views\Plugin\views\argument_validator
View source
class NumericArgumentValidator extends ArgumentValidatorPluginBase {
  public function validateArgument($argument) {
    return is_numeric($argument);
  }

  /**
   * {@inheritdoc}
   */
  public function getContextDefinition() {
    return new ContextDefinition('integer', $this->argument
      ->adminLabel(), FALSE);
  }

}

Members