function views_rss_format_preprocess_views_view_row_rss in Views RSS 8.3
Same name and namespace in other branches
- 8.2 modules/views_rss_format/views_rss_format.module \views_rss_format_preprocess_views_view_row_rss()
Prepares variables for views RSS item templates.
Uses custom views_rss_format_xml_elements() for formatting XML elements instead of core format_xml_elements(), thus allowing to skip special character encoding in selected XML element values (when $element['encoded'] property is set to TRUE).
Default template: views-view-row-rss.html.twig.
Parameters
array $variables: An associative array containing:
- row: The raw results rows.
See also
template_preprocess_views_view_row_rss()
File
- modules/
views_rss_format/ views_rss_format.module, line 79 - Provides custom version of format_xml_elements() function allowing to skip special character encoding in selected XML element values and relevant template_preprocess_views_view_row_rss() implementation.
Code
function views_rss_format_preprocess_views_view_row_rss(&$variables) {
$item = $variables['row'];
$variables['title'] = Html::escape($item->title);
$variables['link'] = UrlHelper::stripDangerousProtocols($item->link);
$variables['description'] = Html::escape($item->description);
$variables['item_elements'] = empty($item->elements) ? '' : views_rss_format_xml_elements($item->elements);
}