interface PreviewAwarePluginInterface

Same name in other branches
  1. 10 core/lib/Drupal/Core/Plugin/PreviewAwarePluginInterface.php \Drupal\Core\Plugin\PreviewAwarePluginInterface
  2. 11.x core/lib/Drupal/Core/Plugin/PreviewAwarePluginInterface.php \Drupal\Core\Plugin\PreviewAwarePluginInterface

Provides an interface to support preview mode injection in plugins.

Block and layout plugins can implement this interface to be informed when preview mode is being used in Layout Builder.

Hierarchy

Expanded class hierarchy of PreviewAwarePluginInterface

All classes that implement PreviewAwarePluginInterface

See also

\Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent

\Drupal\layout_builder\Section::toRenderArray()

4 files declare their use of PreviewAwarePluginInterface
BlockBase.php in core/lib/Drupal/Core/Block/BlockBase.php
LayoutDefault.php in core/lib/Drupal/Core/Layout/LayoutDefault.php
Section.php in core/modules/layout_builder/src/Section.php
SectionComponentBuildRenderArrayEvent.php in core/modules/layout_builder/src/Event/SectionComponentBuildRenderArrayEvent.php

File

core/lib/Drupal/Core/Plugin/PreviewAwarePluginInterface.php, line 14

Namespace

Drupal\Core\Plugin
View source
interface PreviewAwarePluginInterface {
    
    /**
     * Set preview mode for the plugin.
     *
     * @param bool $in_preview
     *   TRUE if the plugin should be set to preview mode, FALSE otherwise.
     */
    public function setInPreview(bool $in_preview) : void;

}

Members

Title Sort descending Modifiers Object type Summary Overrides
PreviewAwarePluginInterface::setInPreview public function Set preview mode for the plugin. 1

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.