1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-06 17:41:01 +00:00

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 <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf 2019-01-06 20:17:35 +01:00
parent 30cf72bf55
commit f810834623
2 changed files with 5 additions and 2 deletions

View file

@ -58,6 +58,7 @@ class ExportController extends Controller
$method = ucfirst($category); $method = ucfirst($category);
$methodBuilder = 'getBuilderFor' . $method . 'ByUser'; $methodBuilder = 'getBuilderFor' . $method . 'ByUser';
$repository = $this->get('wallabag_core.entry_repository'); $repository = $this->get('wallabag_core.entry_repository');
$title = $method;
if ('tag_entries' === $category) { if ('tag_entries' === $category) {
$tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag')); $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag'));
@ -66,6 +67,8 @@ class ExportController extends Controller
$this->getUser()->getId(), $this->getUser()->getId(),
$tag->getId() $tag->getId()
); );
$title = 'Tag ' . $tag->getLabel();
} else { } else {
$entries = $repository $entries = $repository
->$methodBuilder($this->getUser()->getId()) ->$methodBuilder($this->getUser()->getId())
@ -76,7 +79,7 @@ class ExportController extends Controller
try { try {
return $this->get('wallabag_core.helper.entries_export') return $this->get('wallabag_core.helper.entries_export')
->setEntries($entries) ->setEntries($entries)
->updateTitle($method) ->updateTitle($title)
->updateAuthor($method) ->updateAuthor($method)
->exportAs($format); ->exportAs($format);
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {

View file

@ -85,7 +85,7 @@ class EntriesExport
public function updateAuthor($method) public function updateAuthor($method)
{ {
if ('entry' !== $method) { if ('entry' !== $method) {
$this->author = $method . ' authors'; $this->author = 'Various authors';
return $this; return $this;
} }