You are here

function power_menu_entity_view in Power Menu 7.2

Implements hook_entity_view().

File

./power_menu.module, line 199

Code

function power_menu_entity_view($entity, $type, $view_mode, $langcode) {

  // TODO: Add aditional test, that the function is only called on the main entity. At the moment the function is called as many entities shown in full mode (e.g. comments on a full node view)
  // Power menu sets active menu only on full or defined view modes and enabled handlers
  $defined_view_modes = variable_get('power_menu_view_mode', 'full');

  // Is it an array with multiple view modes
  if (is_array($defined_view_modes)) {
    $set_path = in_array($view_mode, $defined_view_modes) ? TRUE : FALSE;
  }
  else {
    $set_path = $view_mode == $defined_view_modes ? TRUE : FALSE;
  }
  if ($set_path && variable_get('power_menu_handlers_enabled', FALSE)) {
    power_menu_set_path($entity, $type, $langcode);
  }
}