]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Add RenameForm as tag list view parameters.
authorStéphane HULARD <s.hulard@chstudio.fr>
Wed, 24 Jan 2018 17:04:39 +0000 (18:04 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Tue, 25 Sep 2018 08:18:08 +0000 (10:18 +0200)
This will help handling the CSRF protection token and use symfony HTML generation layer.
Also a FormView instance is generated for each tag because we need to render a form for each tag and FormView are not reusable.

src/Wallabag/CoreBundle/Controller/TagController.php

index 70b273e0168052cb00fab9193ec7cf4b5036c1bd..a041510d0b4777acb99dcd574b35f8c51c9c55bb 100644 (file)
@@ -88,8 +88,14 @@ class TagController extends Controller
         $tags = $this->get('wallabag_core.tag_repository')
             ->findAllFlatTagsWithNbEntries($this->getUser()->getId());
 
+        $renameForms = [];
+        foreach ($tags as $tag) {
+            $renameForms[$tag['id']] = $this->createForm(RenameTagType::class, new Tag())->createView();
+        }
+
         return $this->render('WallabagCoreBundle:Tag:tags.html.twig', [
             'tags' => $tags,
+            'renameForms' => $renameForms,
         ]);
     }