You are here

function panopoly_widgets_views_post_execute in Panopoly Widgets 7

Implements hook_views_post_execute().

File

./panopoly_widgets.module, line 756

Code

function panopoly_widgets_views_post_execute(&$view) {
  if ($view->name == 'panopoly_widgets_general_content' && $view->current_display == 'piece_of_content') {
    $display =& $view->display[$view->current_display];
    $row_plugin = $view->style_plugin->row_plugin;

    // If we are rendering the actual node, rather than showing fields or a
    // table, then we need to move the title override to the node itself.
    if (is_a($row_plugin, 'entity_views_plugin_row_entity_view') && !empty($view->result[0])) {
      $nid = $view->result[0]->nid;
      $overridden_title = $display->handler->options['title'];
      if (!empty($overridden_title)) {
        _panopoly_widgets_content_item_title_rewrite($nid, $overridden_title);
        $hide_pane_title = FALSE;

        // Attempt to determine if the node title is being shown in the view
        // mode, so that we can hide the pane title and avoid showing it twice.
        $node = node_load($nid);
        if (_panopoly_widgets_is_title_shown($node, $row_plugin->options['view_mode'])) {
          unset($display->handler->options['title']);
        }
      }
    }
  }
}