Version 1
[yaffs-website] / web / core / lib / Drupal / Core / Entity / Plugin / EntityReferenceSelection / Broken.php
diff --git a/web/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/Broken.php b/web/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/Broken.php
new file mode 100644 (file)
index 0000000..f53eeb6
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+namespace Drupal\Core\Entity\Plugin\EntityReferenceSelection;
+
+use Drupal\Core\Database\Query\SelectInterface;
+use Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Defines a fallback plugin for missing entity_reference selection plugins.
+ *
+ * @EntityReferenceSelection(
+ *   id = "broken",
+ *   label = @Translation("Broken/Missing")
+ * )
+ */
+class Broken implements SelectionInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+    $form['selection_handler'] = [
+      '#markup' => t('The selected selection handler is broken.'),
+    ];
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS') {
+    return 0;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function validateReferenceableEntities(array $ids) {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function entityQueryAlter(SelectInterface $query) { }
+
+}