You are here

function hook_ds_views_view_mode_alter in Display Suite 7

Same name and namespace in other branches
  1. 8.4 ds.api.php \hook_ds_views_view_mode_alter()
  2. 8.2 ds.api.php \hook_ds_views_view_mode_alter()
  3. 8.3 ds.api.php \hook_ds_views_view_mode_alter()
  4. 7.2 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

$view_mode: The name of the view mode.

$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()
views_plugin_ds_entity_view::render in views/views_plugin_ds_entity_view.inc
Render each $row.

File

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

Code

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