protected function JsonFeedSerializer::getAuthor in JSON Feed 8
Get JSON feed author information.
Return value
array An array containing the feed's author data.
1 call to JsonFeedSerializer::getAuthor()
- JsonFeedSerializer::render in src/
Plugin/ views/ style/ JsonFeedSerializer.php - Render the display in this style.
File
- src/
Plugin/ views/ style/ JsonFeedSerializer.php, line 203
Class
- JsonFeedSerializer
- Default style plugin to render a JSON feed.
Namespace
Drupal\json_feed\Plugin\views\styleCode
protected function getAuthor() {
if (empty($this->options['author'])) {
return [];
}
$author_data = $this->options['author'];
$author['name'] = !empty($author_data['author_name_field']) ? strip_tags($author_data['author_name_field']) : NULL;
$author['url'] = !empty($author_data['author_url_field']) ? strip_tags($author_data['author_url_field']) : NULL;
$author['avatar'] = !empty($author_data['author_avatar_field']) ? strip_tags($author_data['author_avatar_field']) : NULL;
// Remove empty attributes.
$author = array_filter($author);
return $author;
}