From: Kevin Decherf Date: Sun, 6 Jan 2019 19:17:35 +0000 (+0100) Subject: EntriesExport: change authors and title when not single entry export X-Git-Tag: 2.3.6~2^2~5 X-Git-Url: https://git.immae.eu/?p=github%2Fwallabag%2Fwallabag.git;a=commitdiff_plain;h=f8108346236e18768c08d6c0d4dc5fb4dfe13b78 EntriesExport: change authors and title when not single entry export Change '{method} authors' (which gives 'Tag_entries authors' when exporting a tag) to 'Various authors'. When exporting a tag (tag_entries), change the title from 'Tag_entries articles' to 'Tag {tag} articles'. Signed-off-by: Kevin Decherf --- diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index 7ca89239..9e9dbe49 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php @@ -58,6 +58,7 @@ class ExportController extends Controller $method = ucfirst($category); $methodBuilder = 'getBuilderFor' . $method . 'ByUser'; $repository = $this->get('wallabag_core.entry_repository'); + $title = $method; if ('tag_entries' === $category) { $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag')); @@ -66,6 +67,8 @@ class ExportController extends Controller $this->getUser()->getId(), $tag->getId() ); + + $title = 'Tag ' . $tag->getLabel(); } else { $entries = $repository ->$methodBuilder($this->getUser()->getId()) @@ -76,7 +79,7 @@ class ExportController extends Controller try { return $this->get('wallabag_core.helper.entries_export') ->setEntries($entries) - ->updateTitle($method) + ->updateTitle($title) ->updateAuthor($method) ->exportAs($format); } catch (\InvalidArgumentException $e) { diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 92f1779c..db5340fc 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -85,7 +85,7 @@ class EntriesExport public function updateAuthor($method) { if ('entry' !== $method) { - $this->author = $method . ' authors'; + $this->author = 'Various authors'; return $this; }