class ViewsRulesResultCollector in Views Rules 7
Collector for view iterator results.
Hierarchy
- class \ViewsRulesResultCollector implements ViewsRulesIterable
Expanded class hierarchy of ViewsRulesResultCollector
File
- rules/
views_rules.action.inc, line 84 - Action implementation.
View source
class ViewsRulesResultCollector implements ViewsRulesIterable {
/**
* Variables to collect data for.
* @var array
*/
protected $variables;
/**
* Collected data.
* @var array
*/
protected $data = array();
/**
* Creates a collector.
*
* @param array $variables
* Names of variables to collect.
*/
public function __construct(array $variables) {
$this->variables = $variables;
foreach ($this->variables as $variable) {
$this->data[$variable] = array();
}
}
/**
* Evaluates a view row in the loop.
*/
public function evaluateRow(array $data) {
// Collect data for each variable.
foreach ($this->variables as $variable) {
$this->data[$variable][] = isset($data[$variable]) ? $data[$variable] : NULL;
}
}
/**
* Returns collected data.
*/
public function getData() {
return $this->data;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ViewsRulesResultCollector:: |
protected | property | Collected data. | |
ViewsRulesResultCollector:: |
protected | property | Variables to collect data for. | |
ViewsRulesResultCollector:: |
public | function |
Evaluates a view row in the loop. Overrides ViewsRulesIterable:: |
|
ViewsRulesResultCollector:: |
public | function | Returns collected data. | |
ViewsRulesResultCollector:: |
public | function | Creates a collector. |