public function relation_add_views_plugin_style::render in Relation add 7
Render.
Overrides views_plugin_style::render
File
- modules/
relation_add_views/ views/ relation_add_views_plugin_style.inc, line 54 - Plugin include file for export style plugin.
Class
- relation_add_views_plugin_style
- Generalized style plugin for export plugins.
Code
public function render() {
$options = $this->display->handler
->get_option('relation_add_views_options');
if (empty($options)) {
return parent::render();
}
// Group the rows according to the grouping field, if specified.
$sets = $this
->render_grouping($this->view->result, $this->options['grouping']);
// Grab the alias of the 'id' field added by entityreference_plugin_display.
$id_field_alias = $this->display->handler->id_field_alias;
// @todo We don't display grouping info for now. Could be useful for select
// widget, though.
$results = array();
foreach ($sets as $records) {
foreach ($records as $index => $values) {
$this->view->row_index = $index;
// Sanitize html, remove line breaks and extra whitespace.
$results[$values->{$id_field_alias}] = filter_xss_admin(preg_replace('/\\s\\s+/', ' ', str_replace("\n", '', $this->row_plugin
->render($values))));
}
}
unset($this->view->row_index);
return $results;
}