You are here

function hook_ds_views_view_mode_alter in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 ds.api.php \hook_ds_views_view_mode_alter()
  2. 8.3 ds.api.php \hook_ds_views_view_mode_alter()
  3. 7.2 ds.api.php \hook_ds_views_view_mode_alter()
  4. 7 ds.api.php \hook_ds_views_view_mode_alter()

Alter the view mode just before it's rendered by the DS views entity plugin.

Parameters

string $view_mode: The name of the view mode.

array $context: A collection of items which can be used to identify in what context an entity is being rendered. The variable contains 3 keys:

  • entity: The entity being rendered.
  • view_name: the name of the view.
  • display: the name of the display of the view.
1 invocation of hook_ds_views_view_mode_alter()
RendererBase::dsPreRender in src/Plugin/views/Entity/Render/RendererBase.php
Pre renders all the Display Suite rows.

File

./ds.api.php, line 140
Hooks provided by Display Suite module.

Code

function hook_ds_views_view_mode_alter(&$view_mode, array $context) {
  if ($context['view_name'] == 'my_view_name') {
    $view_mode = 'new_view_mode';
  }
}