PageVariantInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Drupal\Core\Display;
  3. /**
  4. * Provides an interface for PageDisplayVariant plugins.
  5. *
  6. * Page display variants are a specific type of DisplayVariant, intended for
  7. * "pages", which always have some main content to be rendered. Hence page
  8. * display variants may choose to render that main content in a certain way:
  9. * decorated in a certain way, laid out in a certain way, et cetera.
  10. *
  11. * For example, the \Drupal\block\Plugin\DisplayVariant\FullPageVariant page
  12. * display variant is used by the Block module to control regions and output
  13. * blocks placed in those regions.
  14. *
  15. * @see \Drupal\Core\Display\Annotation\DisplayVariant
  16. * @see \Drupal\Core\Display\VariantBase
  17. * @see \Drupal\Core\Display\VariantManager
  18. * @see plugin_api
  19. */
  20. interface PageVariantInterface extends VariantInterface {
  21. /**
  22. * Sets the main content for the page being rendered.
  23. *
  24. * @param array $main_content
  25. * The render array representing the main content.
  26. *
  27. * @return $this
  28. */
  29. public function setMainContent(array $main_content);
  30. /**
  31. * Sets the title for the page being rendered.
  32. *
  33. * @param string|array $title
  34. * The page title: either a string for plain titles or a render array for
  35. * formatted titles.
  36. *
  37. * @return $this
  38. */
  39. public function setTitle($title);
  40. }