Broken.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Drupal\Core\Entity\Plugin\EntityReferenceSelection;
  3. use Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginBase;
  4. use Drupal\Core\Form\FormStateInterface;
  5. /**
  6. * Defines a fallback plugin for missing entity_reference selection plugins.
  7. *
  8. * @EntityReferenceSelection(
  9. * id = "broken",
  10. * label = @Translation("Broken/Missing")
  11. * )
  12. */
  13. class Broken extends SelectionPluginBase {
  14. /**
  15. * {@inheritdoc}
  16. */
  17. public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  18. $form = parent::buildConfigurationForm($form, $form_state);
  19. $form['selection_handler'] = [
  20. '#markup' => t('The selected selection handler is broken.'),
  21. ];
  22. return $form;
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
  28. return [];
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS') {
  34. return 0;
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function validateReferenceableEntities(array $ids) {
  40. return [];
  41. }
  42. }