public function WebformViewsSelectStyle::render_grouping_sets in Webform Views Select 7
Implements views_plugin_style::render_grouping_sets().
Overrides views_plugin_style::render_grouping_sets
File
- ./
WebformViewsSelectStyle.inc, line 83 - Contains WebformViewsSelectStyle.
Class
- WebformViewsSelectStyle
- The style plugin for Webform Views Select.
Code
public function render_grouping_sets($sets, $level = 0) {
$key = $this->options['mapping']['webform_select_key'];
$value = $this->options['mapping']['webform_select_value'];
$output = array();
foreach ($sets as $set) {
// Render as a grouping set.
if (is_array($set) && isset($set['group'])) {
reset($set['rows']);
$output[htmlspecialchars_decode(strip_tags($set['group']))] = $this
->render_grouping_sets($set['rows'], $level + 1);
}
else {
$result = (array) $set;
// We strip HTML tags from the field output because some fields (e.g.
// Date fields) include tags in their output.
$rendered_key = htmlspecialchars_decode(strip_tags($result[$key]), ENT_QUOTES);
if ($this->options['html']['strip'] == FALSE) {
$tags_allowed = explode(' ', $this->options['html']['tags_allowed']);
$rendered_value = filter_xss($result[$value], $tags_allowed);
}
else {
$rendered_value = htmlspecialchars_decode(strip_tags($result[$value]), ENT_QUOTES);
}
$output[$rendered_key] = $rendered_value;
}
}
return $output;
}