Version 1
[yaffs-website] / web / core / modules / field / tests / modules / field_test / src / Plugin / Validation / Constraint / TestFieldConstraint.php
diff --git a/web/core/modules/field/tests/modules/field_test/src/Plugin/Validation/Constraint/TestFieldConstraint.php b/web/core/modules/field/tests/modules/field_test/src/Plugin/Validation/Constraint/TestFieldConstraint.php
new file mode 100644 (file)
index 0000000..8105a22
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\field_test\Plugin\Validation\Constraint;
+
+use Symfony\Component\Validator\Constraints\NotEqualTo;
+
+/**
+ * Checks if a value is not equal.
+ *
+ * @Constraint(
+ *   id = "TestField",
+ *   label = @Translation("Test Field", context = "Validation"),
+ *   type = { "integer" }
+ * )
+ */
+class TestFieldConstraint extends NotEqualTo {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRequiredOptions() {
+    return ['value'];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function validatedBy() {
+    return '\Symfony\Component\Validator\Constraints\NotEqualToValidator';
+  }
+
+}