Loading core/core.api.php +1 −1 Original line number Diff line number Diff line Loading @@ -2169,7 +2169,7 @@ function hook_countries_alter(&$countries) { * The array of display variant definitions, keyed by plugin ID. * * @see \Drupal\Core\Display\VariantManager * @see \Drupal\Core\Display\Annotation\DisplayVariant * @see \Drupal\Core\Display\Attribute\DisplayVariant */ function hook_display_variant_plugin_alter(array &$definitions) { $definitions['full_page']['admin_label'] = t('Block layout'); Loading core/lib/Drupal/Core/Display/Attribute/DisplayVariant.php 0 → 100644 +50 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Display\Attribute; use Drupal\Component\Plugin\Attribute\Plugin; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Defines a display variant attribute object. * * Display variants are used to dictate the output of a given Display, which * can be used to control the output of many parts of Drupal. * * Variants are usually chosen by some selection criteria, and are instantiated * directly. Each variant must define its own approach to rendering, and can * either load its own data or be injected with data from another Display * object. * * Plugin namespace: Plugin\DisplayVariant * * For working examples, see * - \Drupal\Core\Render\Plugin\DisplayVariant\SimplePageVariant * - \Drupal\block\Plugin\DisplayVariant\BlockPageVariant * * @see \Drupal\Core\Display\VariantInterface * @see \Drupal\Core\Display\VariantBase * @see \Drupal\Core\Display\VariantManager * @see \Drupal\Core\Display\PageVariantInterface * @see plugin_api */ #[\Attribute(\Attribute::TARGET_CLASS)] class DisplayVariant extends Plugin { /** * Constructs a DisplayVariant plugin attribute object. * * @param string $id * The plugin ID. * @param \Drupal\Core\StringTranslation\TranslatableMarkup $admin_label * The administrative label. * @param class-string|null $deriver * (optional) The deriver class. */ public function __construct( public readonly string $id, public readonly TranslatableMarkup $admin_label, public readonly ?string $deriver = NULL ) {} } core/lib/Drupal/Core/Display/Attribute/PageDisplayVariant.php 0 → 100644 +21 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Display\Attribute; /** * Defines a page display variant attribute object. * * Page display variants are a specific type of display variant, intended to * render entire pages. They must render the crucial parts of a page, which are: * - the title * - the main content * - any messages (#type => status_messages) * * @see \Drupal\Core\Display\VariantInterface * @see \Drupal\Core\Display\PageVariantInterface * @see \Drupal\Core\Display\VariantBase * @see \Drupal\Core\Display\VariantManager * @see plugin_api */ #[\Attribute(\Attribute::TARGET_CLASS)] class PageDisplayVariant extends DisplayVariant {} core/lib/Drupal/Core/Display/PageVariantInterface.php +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * display variant is used by the Block module to control regions and output * blocks placed in those regions. * * @see \Drupal\Core\Display\Annotation\DisplayVariant * @see \Drupal\Core\Display\Attribute\DisplayVariant * @see \Drupal\Core\Display\VariantBase * @see \Drupal\Core\Display\VariantManager * @see plugin_api Loading core/lib/Drupal/Core/Display/VariantBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ /** * Provides a base class for DisplayVariant plugins. * * @see \Drupal\Core\Display\Annotation\DisplayVariant * @see \Drupal\Core\Display\Attribute\DisplayVariant * @see \Drupal\Core\Display\VariantInterface * @see \Drupal\Core\Display\VariantManager * @see plugin_api Loading Loading
core/core.api.php +1 −1 Original line number Diff line number Diff line Loading @@ -2169,7 +2169,7 @@ function hook_countries_alter(&$countries) { * The array of display variant definitions, keyed by plugin ID. * * @see \Drupal\Core\Display\VariantManager * @see \Drupal\Core\Display\Annotation\DisplayVariant * @see \Drupal\Core\Display\Attribute\DisplayVariant */ function hook_display_variant_plugin_alter(array &$definitions) { $definitions['full_page']['admin_label'] = t('Block layout'); Loading
core/lib/Drupal/Core/Display/Attribute/DisplayVariant.php 0 → 100644 +50 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Display\Attribute; use Drupal\Component\Plugin\Attribute\Plugin; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Defines a display variant attribute object. * * Display variants are used to dictate the output of a given Display, which * can be used to control the output of many parts of Drupal. * * Variants are usually chosen by some selection criteria, and are instantiated * directly. Each variant must define its own approach to rendering, and can * either load its own data or be injected with data from another Display * object. * * Plugin namespace: Plugin\DisplayVariant * * For working examples, see * - \Drupal\Core\Render\Plugin\DisplayVariant\SimplePageVariant * - \Drupal\block\Plugin\DisplayVariant\BlockPageVariant * * @see \Drupal\Core\Display\VariantInterface * @see \Drupal\Core\Display\VariantBase * @see \Drupal\Core\Display\VariantManager * @see \Drupal\Core\Display\PageVariantInterface * @see plugin_api */ #[\Attribute(\Attribute::TARGET_CLASS)] class DisplayVariant extends Plugin { /** * Constructs a DisplayVariant plugin attribute object. * * @param string $id * The plugin ID. * @param \Drupal\Core\StringTranslation\TranslatableMarkup $admin_label * The administrative label. * @param class-string|null $deriver * (optional) The deriver class. */ public function __construct( public readonly string $id, public readonly TranslatableMarkup $admin_label, public readonly ?string $deriver = NULL ) {} }
core/lib/Drupal/Core/Display/Attribute/PageDisplayVariant.php 0 → 100644 +21 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Display\Attribute; /** * Defines a page display variant attribute object. * * Page display variants are a specific type of display variant, intended to * render entire pages. They must render the crucial parts of a page, which are: * - the title * - the main content * - any messages (#type => status_messages) * * @see \Drupal\Core\Display\VariantInterface * @see \Drupal\Core\Display\PageVariantInterface * @see \Drupal\Core\Display\VariantBase * @see \Drupal\Core\Display\VariantManager * @see plugin_api */ #[\Attribute(\Attribute::TARGET_CLASS)] class PageDisplayVariant extends DisplayVariant {}
core/lib/Drupal/Core/Display/PageVariantInterface.php +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * display variant is used by the Block module to control regions and output * blocks placed in those regions. * * @see \Drupal\Core\Display\Annotation\DisplayVariant * @see \Drupal\Core\Display\Attribute\DisplayVariant * @see \Drupal\Core\Display\VariantBase * @see \Drupal\Core\Display\VariantManager * @see plugin_api Loading
core/lib/Drupal/Core/Display/VariantBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ /** * Provides a base class for DisplayVariant plugins. * * @see \Drupal\Core\Display\Annotation\DisplayVariant * @see \Drupal\Core\Display\Attribute\DisplayVariant * @see \Drupal\Core\Display\VariantInterface * @see \Drupal\Core\Display\VariantManager * @see plugin_api Loading