You are here

function views_rules_collect_rows in Views Rules 7

Collects view results.

2 string references to 'views_rules_collect_rows'
ViewsRulesUpdateTestCase::testCleanCollectActionVariableNames in tests/views_rules.test
Tests views_rules_update_clean_collect_action_variable_names().
views_rules_update_clean_collect_action_variable_names in ./views_rules.install
Cleans up variable names in collect actions.

File

rules/views_rules.action.inc, line 10
Action implementation.

Code

function views_rules_collect_rows($view_display_id) {

  // Load iterator.
  if (!($view = views_rules_get_view($view_display_id))) {

    // Fail.
    return array();
  }

  /** @var $iterator views_rules_iterator */
  $iterator = $view->display_handler;

  // Collect arguments to give the view.
  $args = func_get_args();
  array_shift($args);

  // Create a collector.
  $collector = new ViewsRulesResultCollector(array_keys($iterator
    ->get_rules_variable_info()));
  $iterator
    ->execute_iterator($args, $collector);

  // Return data.
  $data = $collector
    ->getData();
  return $data;
}