From: Stéphane HULARD Date: Wed, 24 Jan 2018 17:04:39 +0000 (+0100) Subject: Add RenameForm as tag list view parameters. X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;ds=sidebyside;h=b846c1e4d03ec51ae6b740040d79d47d9bdec12c;p=github%2Fwallabag%2Fwallabag.git Add RenameForm as tag list view parameters. 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. --- diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 70b273e0..a041510d 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -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, ]); }