public function OpmlFields::render in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/row/OpmlFields.php \Drupal\views\Plugin\views\row\OpmlFields::render()
- 9 core/modules/views/src/Plugin/views/row/OpmlFields.php \Drupal\views\Plugin\views\row\OpmlFields::render()
File
- core/
modules/ views/ src/ Plugin/ views/ row/ OpmlFields.php, line 172
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 = [];
$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 = [
'#theme' => $this
->themeFunctions(),
'#view' => $this->view,
'#options' => $this->options,
'#row' => $item,
'#field_alias' => $this->field_alias ?? '',
];
return $build;
}