public function OpmlFields::render in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/row/OpmlFields.php \Drupal\views\Plugin\views\row\OpmlFields::render()
Render a row object. This usually passes through to a theme template of some form, but not always.
Parameters
object $row: A single row of the query result, so an element of $view->result.
Return value
string The rendered output of a single row, used by the style plugin.
Overrides RowPluginBase::render
File
- core/
modules/ views/ src/ Plugin/ views/ row/ OpmlFields.php, line 177 - Contains \Drupal\views\Plugin\views\row\OpmlFields.
Class
- OpmlFields
- Renders an OPML item based on fields.
Namespace
Drupal\views\Plugin\views\rowCode
public function render($row) {
// Create the OPML item array.
$item = array();
$row_index = $this->view->row_index;
$item['text'] = $this
->getField($row_index, $this->options['text_field']);
$item['created'] = $this
->getField($row_index, $this->options['created_field']);
if ($this->options['type_field']) {
$item['type'] = $this->options['type_field'];
if ($item['type'] == 'rss') {
$item['description'] = $this
->getField($row_index, $this->options['description_field']);
$item['language'] = $this
->getField($row_index, $this->options['language_field']);
$item['xmlUrl'] = $this
->getField($row_index, $this->options['xml_url_field']);
$item['htmlUrl'] = $this
->getField($row_index, $this->options['html_url_field']);
}
else {
$item['url'] = $this
->getField($row_index, $this->options['url_field']);
}
}
// Remove empty attributes.
$item = array_filter($item);
$build = array(
'#theme' => $this
->themeFunctions(),
'#view' => $this->view,
'#options' => $this->options,
'#row' => $item,
'#field_alias' => isset($this->field_alias) ? $this->field_alias : '',
);
return $build;
}