EntityDisplayRepositoryInterface.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace Drupal\Core\Entity;
  3. /**
  4. * Provides an interface for an entity display repository.
  5. */
  6. interface EntityDisplayRepositoryInterface {
  7. /**
  8. * Gets the entity view mode info for all entity types.
  9. *
  10. * @return array
  11. * The view mode info for all entity types.
  12. */
  13. public function getAllViewModes();
  14. /**
  15. * Gets the entity view mode info for a specific entity type.
  16. *
  17. * @param string $entity_type_id
  18. * The entity type whose view mode info should be returned.
  19. *
  20. * @return array
  21. * The view mode info for a specific entity type.
  22. */
  23. public function getViewModes($entity_type_id);
  24. /**
  25. * Gets the entity form mode info for all entity types.
  26. *
  27. * @return array
  28. * The form mode info for all entity types.
  29. */
  30. public function getAllFormModes();
  31. /**
  32. * Gets the entity form mode info for a specific entity type.
  33. *
  34. * @param string $entity_type_id
  35. * The entity type whose form mode info should be returned.
  36. *
  37. * @return array
  38. * The form mode info for a specific entity type.
  39. */
  40. public function getFormModes($entity_type_id);
  41. /**
  42. * Gets an array of view mode options.
  43. *
  44. * @param string $entity_type_id
  45. * The entity type whose view mode options should be returned.
  46. *
  47. * @return array
  48. * An array of view mode labels, keyed by the display mode ID.
  49. */
  50. public function getViewModeOptions($entity_type_id);
  51. /**
  52. * Gets an array of form mode options.
  53. *
  54. * @param string $entity_type_id
  55. * The entity type whose form mode options should be returned.
  56. *
  57. * @return array
  58. * An array of form mode labels, keyed by the display mode ID.
  59. */
  60. public function getFormModeOptions($entity_type_id);
  61. /**
  62. * Returns an array of enabled view mode options by bundle.
  63. *
  64. * @param string $entity_type_id
  65. * The entity type whose view mode options should be returned.
  66. * @param string $bundle
  67. * The name of the bundle.
  68. *
  69. * @return array
  70. * An array of view mode labels, keyed by the display mode ID.
  71. */
  72. public function getViewModeOptionsByBundle($entity_type_id, $bundle);
  73. /**
  74. * Returns an array of enabled form mode options by bundle.
  75. *
  76. * @param string $entity_type_id
  77. * The entity type whose form mode options should be returned.
  78. * @param string $bundle
  79. * The name of the bundle.
  80. *
  81. * @return array
  82. * An array of form mode labels, keyed by the display mode ID.
  83. */
  84. public function getFormModeOptionsByBundle($entity_type_id, $bundle);
  85. /**
  86. * Clears the gathered display mode info.
  87. *
  88. * @return $this
  89. */
  90. public function clearDisplayModeInfo();
  91. }