AttachmentsInterface.php 879 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Drupal\Core\Render;
  3. /**
  4. * Defines an interface for responses that can expose #attached metadata.
  5. *
  6. * @todo If in Drupal 9, we remove attachments other than assets (libraries +
  7. * drupalSettings), then we can look into unifying this with
  8. * \Drupal\Core\Asset\AttachedAssetsInterface.
  9. *
  10. * @see \Drupal\Core\Render\AttachmentsTrait
  11. */
  12. interface AttachmentsInterface {
  13. /**
  14. * Gets attachments.
  15. *
  16. * @return array
  17. * The attachments.
  18. */
  19. public function getAttachments();
  20. /**
  21. * Adds attachments.
  22. *
  23. * @param array $attachments
  24. * The attachments to add.
  25. *
  26. * @return $this
  27. */
  28. public function addAttachments(array $attachments);
  29. /**
  30. * Sets attachments.
  31. *
  32. * @param array $attachments
  33. * The attachments to set.
  34. *
  35. * @return $this
  36. */
  37. public function setAttachments(array $attachments);
  38. }