You are here

function hook_panelizer_pre_view_builder_alter in Panelizer 8.3

Same name and namespace in other branches
  1. 8.5 panelizer.api.php \hook_panelizer_pre_view_builder_alter()
  2. 8.4 panelizer.api.php \hook_panelizer_pre_view_builder_alter()

Allow other modules to alter view data.

Parameters

string $view_mode: The view_mode being rendered.

object $entity: The entity being viewed.

string $langcode: The langcode.

1 invocation of hook_panelizer_pre_view_builder_alter()
PanelizerEntityViewBuilder::view in src/PanelizerEntityViewBuilder.php
Builds the render array for the provided entity.

File

./panelizer.api.php, line 22
Developer documentation.

Code

function hook_panelizer_pre_view_builder_alter(&$view_mode, \Drupal\Core\Entity\EntityInterface $entity, &$langcode) {
  if ($entity
    ->bundle() == 'article') {
    $view_mode = 'my_custom_view_mode';
  }
}