]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Use the article publisher as author for export
authorÉtienne Gilli <etienne.gilli@gmail.com>
Sun, 9 Jul 2017 16:33:14 +0000 (18:33 +0200)
committerÉtienne Gilli <etienne.gilli@gmail.com>
Sun, 9 Jul 2017 16:33:14 +0000 (18:33 +0200)
When exporting an entry, use the publishedBy field as author name for
epub, mobi and pdf formats. Fallback to domain name if empty.

src/Wallabag/CoreBundle/Helper/EntriesExport.php

index d749dcf91adc422a832ec207bed4362af4085f80..e16168b147ee0bc2f9568e792236f108e95a1f33 100644 (file)
@@ -73,7 +73,9 @@ class EntriesExport
     }
 
     /**
-     * Sets the author for just one entry.
+     * Sets the author for one entry or category.
+     *
+     * The publishers are used, or the domain name if empty.
      *
      * @param string $method Method to get articles
      *
@@ -84,7 +86,12 @@ class EntriesExport
         $this->author = $method.' authors';
 
         if ('entry' === $method) {
-            $this->author = $this->entries[0]->getDomainName();
+            $publishedBy = $this->entries[0]->getPublishedBy();
+            if (!empty($publishedBy)) {
+                $this->author = implode(', ', $this->entries[0]->getPublishedBy());
+            } else {
+                $this->author = $this->entries[0]->getDomainName();
+            }
         }
 
         return $this;