class NumericArgumentValidator

Same name and namespace in other branches
  1. 11.x 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

Expanded class hierarchy of NumericArgumentValidator

Related topics

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);
  }

}

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