Version 1
[yaffs-website] / web / core / modules / views / src / Plugin / views / argument_validator / None.php
diff --git a/web/core/modules/views/src/Plugin/views/argument_validator/None.php b/web/core/modules/views/src/Plugin/views/argument_validator/None.php
new file mode 100644 (file)
index 0000000..8e8c965
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+namespace Drupal\views\Plugin\views\argument_validator;
+
+/**
+ * Do not validate the argument.
+ *
+ * @ingroup views_argument_validate_plugins
+ *
+ * @ViewsArgumentValidator(
+ *   id = "none",
+ *   title = @Translation(" - Basic validation - ")
+ * )
+ */
+class None extends ArgumentValidatorPluginBase {
+
+  public function validateArgument($argument) {
+    if (!empty($this->argument->options['must_not_be'])) {
+      return !isset($argument);
+    }
+
+    if (!isset($argument) || $argument === '') {
+      return FALSE;
+    }
+
+    if (!empty($this->argument->definition['numeric']) && !isset($this->argument->options['break_phrase']) && !is_numeric($arg)) {
+      return FALSE;
+    }
+
+    return TRUE;
+  }
+
+}