EntityListBuilderInterface.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Drupal\Core\Entity;
  3. /**
  4. * Defines an interface to build entity listings.
  5. */
  6. interface EntityListBuilderInterface {
  7. /**
  8. * Gets the entity storage.
  9. *
  10. * @return \Drupal\Core\Entity\EntityStorageInterface
  11. * The storage used by this list builder.
  12. */
  13. public function getStorage();
  14. /**
  15. * Loads entities of this type from storage for listing.
  16. *
  17. * This allows the implementation to manipulate the listing, like filtering or
  18. * sorting the loaded entities.
  19. *
  20. * @return \Drupal\Core\Entity\EntityInterface[]
  21. * An array of entities implementing \Drupal\Core\Entity\EntityInterface
  22. * indexed by their IDs. Returns an empty array if no matching entities are
  23. * found.
  24. */
  25. public function load();
  26. /**
  27. * Provides an array of information to build a list of operation links.
  28. *
  29. * @param \Drupal\Core\Entity\EntityInterface $entity
  30. * The entity the operations are for.
  31. *
  32. * @return array
  33. * An associative array of operation link data for this list, keyed by
  34. * operation name, containing the following key-value pairs:
  35. * - title: The localized title of the operation.
  36. * - url: An instance of \Drupal\Core\Url for the operation URL.
  37. * - weight: The weight of this operation.
  38. */
  39. public function getOperations(EntityInterface $entity);
  40. /**
  41. * Builds a listing of entities for the given entity type.
  42. *
  43. * @return array
  44. * A render array as expected by drupal_render().
  45. */
  46. public function render();
  47. }