You are here

protected function views_aggregator_plugin_style_table::execute_view_without_pager in Views Aggregator Plus 7

Strips the pager off an existing View, then executes and renders it.

The View is rebuilt from scratch, without the extra pager query. The View passed in as an argument is in no way affected.

Parameters

object $view_with_pager: A View object.

object $display_id: The display to execute, for example 'default', 'page', 'block'.

Return value

object The pageless View, including the complete rendered results set on $view->style_plugin->rendered_fields.

1 call to views_aggregator_plugin_style_table::execute_view_without_pager()
views_aggregator_plugin_style_table::pre_render in views/views_aggregator_plugin_style_table.inc
Overrides pre_render().

File

views/views_aggregator_plugin_style_table.inc, line 1091
views_aggregator_plugin_style_table.inc

Class

views_aggregator_plugin_style_table
Style plugin to render each item as a row in a table.

Code

protected function execute_view_without_pager($view_with_pager, $display_id = NULL) {

  // Apply the filters so the results reflect accurately.
  $this
    ->apply_exposed_filters($view_with_pager);
  $clone = $view_with_pager
    ->clone_view();
  $id = empty($clone->display[$display_id]->display_options['pager']) ? 'default' : $display_id;
  $clone->display[$id]->display_options['pager']['type'] = 'none';
  $clone->is_temp_views_aggregator = TRUE;
  $clone
    ->execute($display_id);
  return $clone;

  /*
      //  Alternative code below is based on view::copy()
      $code = $view_with_pager->export();
      $code_without_pagers = str_replace(
        "display_options['pager']['type'] = ",
        "display_options['pager']['type'] = 'none'; //", $code);

      // This statement creates a View object by the name of $view.
      eval($code_without_pagers);

      // [#2213417], to avoid notice.
      $view->dom_id = $view_with_pager->dom_id;

      // Avoid recursion in views_aggregator_plugin_style_table::pre_render().
      $view->is_temp_views_aggregator = TRUE;

      // As this is a copy, let's keep caching behaviour the same as the original.

      // Execute the display.
      $view->execute($display_id); // may have to be: $view->render($display_id);
      return $view;
  */
}