public function deleteTagAction(Request $request, Tag $tag)
    {
        $this->denyAccessUnlessGranted('ez:tags:delete' . ($tag->isSynonym() ? 'synonym' : ''));

        if ($request->request->has('DeleteTagButton')) {
            if (!$this->isCsrfTokenValid('eztags_admin', $request->request->get('_csrf_token'))) {
                $this->addFlashMessage('errors', 'invalid_csrf_token');

                return $this->redirectToTag($tag);
            }

            $this->tagsService->deleteTag($tag);

            $this->addFlashMessage('success', 'tag_deleted', ['%tagKeyword%' => $tag->keyword]);

            return $this->redirectToTag();
        }

        return $this->render(
            '@NetgenTags/admin/tag/delete.html.twig',
            [
                'tag' => $tag,
            ]
        );
    }
public function deleteTagAction(Request $request, Tag $tag)
    {
        $this->denyAccessUnlessGranted('ez:tags:delete' . ($tag->isSynonym() ? 'synonym' : ''));

        if ($request->request->has('DeleteTagButton')) {
            if (!$this->isCsrfTokenValid('eztags_admin', $request->request->get('_csrf_token'))) {
                $this->addFlashMessage('errors', 'invalid_csrf_token');

                return $this->redirectToTag($tag);
            }

            $this->tagsService->deleteTag($tag);

            $this->addFlashMessage('success', 'tag_deleted', ['%tagKeyword%' => $tag->keyword]);

            return $this->redirectToTag();
        }

        return $this->render(
            '@NetgenTags/admin/tag/delete.html.twig',
            [
                'tag' => $tag,
            ]
        );
    }
public function deleteTagAction ( Request $ request , Tag $ tag ) { $ this -> denyAccessUnlessGranted ( 'ez:tags:delete' . ( $ tag -> isSynonym ( ) ? 'synonym' : '' ) ) ; if ( $ request -> request -> has ( 'DeleteTagButton' ) ) { if ( ! $ this -> isCsrfTokenValid ( 'eztags_admin' , $ request -> request -> get ( '_csrf_token' ) ) ) { $ this -> addFlashMessage ( 'errors' , 'invalid_csrf_token' ) ; return $ this -> redirectToTag ( $ tag ) ; } $ this -> tagsService -> deleteTag ( $ tag ) ; $ this -> addFlashMessage ( 'success' , 'tag_deleted' , [ '%tagKeyword%' => $ tag -> keyword ] ) ; return $ this -> redirectToTag ( ) ; } return $ this -> render ( '@NetgenTags/admin/tag/delete.html.twig' , [ 'tag' => $ tag , ] ) ; }
This method is called for delete tag or synonym action.
It shows a confirmation view.
If form has been submitted, it deletes the tag or synonym and redirects to dashboard.

@param \Symfony\Component\HttpFoundation\Request $request
@param \Netgen\TagsBundle\API\Repository\Values\Tags\Tag $tag

@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
This method is called for delete tag or synonym action . It shows a confirmation view . If form has been submitted it deletes the tag or synonym and redirects to dashboard .