$this->assignView('tags_separator', $separator);
$this->assignView(
'pagetitle',
- t('Manage tags') .' - '. $this->container->conf->get('general.title', 'Shaarli')
+ t('Manage tags') . ' - ' . $this->container->conf->get('general.title', 'Shaarli')
);
return $response->write($this->render(TemplatePage::CHANGE_TAG));
}
// TODO: move this to bookmark service
- $count = 0;
- $bookmarks = $this->container->bookmarkService->search(['searchtags' => $fromTag], BookmarkFilter::$ALL, true);
- foreach ($bookmarks as $bookmark) {
+ $searchResult = $this->container->bookmarkService->search(
+ ['searchtags' => $fromTag],
+ BookmarkFilter::$ALL,
+ true
+ );
+ foreach ($searchResult->getBookmarks() as $bookmark) {
if (false === $isDelete) {
$bookmark->renameTag($fromTag, $toTag);
} else {
$this->container->bookmarkService->set($bookmark, false);
$this->container->history->updateLink($bookmark);
- $count++;
}
$this->container->bookmarkService->save();
+ $count = $searchResult->getResultCount();
if (true === $isDelete) {
$alert = sprintf(
t('The tag was removed from %d bookmark.', 'The tag was removed from %d bookmarks.', $count),
$this->saveSuccessMessage($alert);
- $redirect = true === $isDelete ? '/admin/tags' : '/?searchtags='. urlencode($toTag);
+ $redirect = true === $isDelete ? '/admin/tags' : '/?searchtags=' . urlencode($toTag);
return $this->redirect($response, $redirect);
}