return $this->get('wallabag_core.helper.entries_export')
->setEntries($entry)
->updateTitle('entry')
+ ->updateAuthor('entry')
->exportAs($format);
} catch (\InvalidArgumentException $e) {
throw new NotFoundHttpException($e->getMessage());
return $this->get('wallabag_core.helper.entries_export')
->setEntries($entries)
->updateTitle($method)
+ ->updateAuthor($method)
->exportAs($format);
} catch (\InvalidArgumentException $e) {
throw new NotFoundHttpException($e->getMessage());
private $logoPath;
private $title = '';
private $entries = [];
- private $authors = ['wallabag'];
+ private $author = 'wallabag';
private $language = '';
private $footerTemplate = '<div style="text-align:center;">
<p>Produced by wallabag with %EXPORT_METHOD%</p>
return $this;
}
+ /**
+ * Sets the author for just one entry.
+ *
+ * @param string $method Method to get articles
+ *
+ * @return EntriesExport
+ */
+ public function updateAuthor($method)
+ {
+ $this->author = $method.' authors';
+
+ if ('entry' === $method) {
+ $this->author = $this->entries[0]->getDomainName();
+ }
+
+ return $this;
+ }
+
/**
* Sets the output format.
*
$book->setLanguage($this->language);
$book->setDescription('Some articles saved on my wallabag');
- foreach ($this->authors as $author) {
- $book->setAuthor($author, $author);
- }
+ $book->setAuthor($this->author, $this->author);
// I hope this is a non existant address :)
$book->setPublisher('wallabag', 'wallabag');
* Book metadata
*/
$content->set('title', $this->title);
- $content->set('author', implode($this->authors));
+ $content->set('author', $this->author);
$content->set('subject', $this->title);
/*
* Book metadata
*/
$pdf->SetCreator(PDF_CREATOR);
- $pdf->SetAuthor('wallabag');
+ $pdf->SetAuthor($this->author);
$pdf->SetTitle($this->title);
$pdf->SetSubject('Articles via wallabag');
$pdf->SetKeywords('wallabag');