You are here

interface PanelizerEntityInterface in Panelizer 8.5

Same name and namespace in other branches
  1. 8.3 src/Plugin/PanelizerEntityInterface.php \Drupal\panelizer\Plugin\PanelizerEntityInterface
  2. 8.4 src/Plugin/PanelizerEntityInterface.php \Drupal\panelizer\Plugin\PanelizerEntityInterface

Defines an interface for Panelizer entity plugins.

Hierarchy

Expanded class hierarchy of PanelizerEntityInterface

All classes that implement PanelizerEntityInterface

1 file declares its use of PanelizerEntityInterface
PanelizerEntityViewBuilderTest.php in tests/src/Unit/PanelizerEntityViewBuilderTest.php

File

src/Plugin/PanelizerEntityInterface.php, line 13

Namespace

Drupal\panelizer\Plugin
View source
interface PanelizerEntityInterface extends PluginInspectionInterface {

  // @todo: Do we need get the form alterations in the right place or is this standardized in D8?
  // @todo: Do we need something to tell page_manager where the entity view page is?
  // @todo: In D7 there's lots more stuff on the plugin, like permissions, admin routes, etc..

  /**
   * Creates a default Panels display from the core Entity display.
   *
   * As much as possible, this should attempt to make the settings on the
   * Panels display match the existing core settings, so that ideally the user
   * doesn't notice any change upon Panelizing an entity's view mode.
   *
   * @param \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display
   *   The entity view display holding the display options configured for the
   *   entity components.
   * @param string $bundle
   *   The bundle to panelize.
   * @param string $view_mode
   *   The view mode to panelize.
   *
   * @return \Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant
   */
  public function getDefaultDisplay(EntityViewDisplayInterface $display, $bundle, $view_mode);

  /**
   * Alter the built entity view in an entity specific way before rendering.
   *
   * This is useful for adding things like contextual links.
   *
   * @param array $build
   *   The render array that is being created.
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity to be prepared.
   * @param \Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant $panels_display
   *   The Panels display used to render this entity.
   * @param string $view_mode
   *   The view mode that should be used to prepare the entity.
   */
  public function alterBuild(array &$build, EntityInterface $entity, PanelsDisplayVariant $panels_display, $view_mode);

  /**
   * Preprocess the variables for the view mode template.
   *
   * @param array $variables
   *   The variables to pass to the view mode template.
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity.
   * @param \Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant $panels_display
   *   The Panels display used to render this entity.
   * @param string $view_mode
   *   The view mode.
   */
  public function preprocessViewMode(array &$variables, EntityInterface $entity, PanelsDisplayVariant $panels_display, $view_mode);

}

Members

Namesort descending Modifiers Type Description Overrides
PanelizerEntityInterface::alterBuild public function Alter the built entity view in an entity specific way before rendering. 1
PanelizerEntityInterface::getDefaultDisplay public function Creates a default Panels display from the core Entity display. 1
PanelizerEntityInterface::preprocessViewMode public function Preprocess the variables for the view mode template. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2