interface PageVariantInterface in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Display/PageVariantInterface.php \Drupal\Core\Display\PageVariantInterface
- 9 core/lib/Drupal/Core/Display/PageVariantInterface.php \Drupal\Core\Display\PageVariantInterface
Provides an interface for PageDisplayVariant plugins.
Page display variants are a specific type of DisplayVariant, intended for "pages", which always have some main content to be rendered. Hence page display variants may choose to render that main content in a certain way: decorated in a certain way, laid out in a certain way, et cetera.
For example, the \Drupal\block\Plugin\DisplayVariant\FullPageVariant page display variant is used by the Block module to control regions and output blocks placed in those regions.
Hierarchy
- interface \Drupal\Component\Plugin\PluginInspectionInterface; interface \Drupal\Component\Plugin\ConfigurableInterface; interface \Drupal\Component\Plugin\DependentPluginInterface; interface \Drupal\Core\Plugin\PluginFormInterface; interface \Drupal\Core\Cache\RefinableCacheableDependencyInterface
- interface \Drupal\Core\Display\VariantInterface
- interface \Drupal\Core\Display\PageVariantInterface
- interface \Drupal\Core\Display\VariantInterface
Expanded class hierarchy of PageVariantInterface
All classes that implement PageVariantInterface
See also
\Drupal\Core\Display\Annotation\DisplayVariant
\Drupal\Core\Display\VariantBase
\Drupal\Core\Display\VariantManager
4 files declare their use of PageVariantInterface
- BlockPageVariant.php in core/
modules/ block/ src/ Plugin/ DisplayVariant/ BlockPageVariant.php - HtmlRenderer.php in core/
lib/ Drupal/ Core/ Render/ MainContent/ HtmlRenderer.php - SimplePageVariant.php in core/
lib/ Drupal/ Core/ Render/ Plugin/ DisplayVariant/ SimplePageVariant.php - TestDisplayVariant.php in core/
modules/ system/ tests/ modules/ display_variant_test/ src/ Plugin/ DisplayVariant/ TestDisplayVariant.php
File
- core/
lib/ Drupal/ Core/ Display/ PageVariantInterface.php, line 22
Namespace
Drupal\Core\DisplayView source
interface PageVariantInterface extends VariantInterface {
/**
* Sets the main content for the page being rendered.
*
* @param array $main_content
* The render array representing the main content.
*
* @return $this
*/
public function setMainContent(array $main_content);
/**
* Sets the title for the page being rendered.
*
* @param string|array $title
* The page title: either a string for plain titles or a render array for
* formatted titles.
*
* @return $this
*/
public function setTitle($title);
}