public function addSynonymSelectAction(Request $request, $mainTagId)
    {
        $this->denyAccessUnlessGranted('ez:tags:addsynonym');

        $availableLanguages = $this->getConfigResolver()->getParameter('languages');
        if (count($availableLanguages) === 1) {
            return $this->redirectToRoute(
                'netgen_tags_admin_synonym_add',
                [
                    'mainTagId' => $mainTagId,
                    'languageCode' => $availableLanguages[0],
                ]
            );
        }

        $form = $this->createForm(
            LanguageSelectType::class,
            null,
            [
                'action' => $request->getPathInfo(),
            ]
        );

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            return $this->redirectToRoute(
                'netgen_tags_admin_synonym_add',
                [
                    'mainTagId' => $mainTagId,
                    'languageCode' => $form->getData()['languageCode'],
                ]
            );
        }

        return $this->render(
            '@NetgenTags/admin/tag/select_translation.html.twig',
            [
                'form' => $form->createView(),
            ]
        );
    }
public function addSynonymSelectAction(Request $request, $mainTagId)
    {
        $this->denyAccessUnlessGranted('ez:tags:addsynonym');

        $availableLanguages = $this->getConfigResolver()->getParameter('languages');
        if (count($availableLanguages) === 1) {
            return $this->redirectToRoute(
                'netgen_tags_admin_synonym_add',
                [
                    'mainTagId' => $mainTagId,
                    'languageCode' => $availableLanguages[0],
                ]
            );
        }

        $form = $this->createForm(
            LanguageSelectType::class,
            null,
            [
                'action' => $request->getPathInfo(),
            ]
        );

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            return $this->redirectToRoute(
                'netgen_tags_admin_synonym_add',
                [
                    'mainTagId' => $mainTagId,
                    'languageCode' => $form->getData()['languageCode'],
                ]
            );
        }

        return $this->render(
            '@NetgenTags/admin/tag/select_translation.html.twig',
            [
                'form' => $form->createView(),
            ]
        );
    }
public function addSynonymSelectAction ( Request $ request , $ mainTagId ) { $ this -> denyAccessUnlessGranted ( 'ez:tags:addsynonym' ) ; $ availableLanguages = $ this -> getConfigResolver ( ) -> getParameter ( 'languages' ) ; if ( count ( $ availableLanguages ) === 1 ) { return $ this -> redirectToRoute ( 'netgen_tags_admin_synonym_add' , [ 'mainTagId' => $ mainTagId , 'languageCode' => $ availableLanguages [ 0 ] , ] ) ; } $ form = $ this -> createForm ( LanguageSelectType :: class , null , [ 'action' => $ request -> getPathInfo ( ) , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { return $ this -> redirectToRoute ( 'netgen_tags_admin_synonym_add' , [ 'mainTagId' => $ mainTagId , 'languageCode' => $ form -> getData ( ) [ 'languageCode' ] , ] ) ; } return $ this -> render ( '@NetgenTags/admin/tag/select_translation.html.twig' , [ 'form' => $ form -> createView ( ) , ] ) ; }
This method is called for add new synonym action without selected language.
It renders a form to select language for the keyword of new synonym.

@param \Symfony\Component\HttpFoundation\Request $request
@param int|string $mainTagId

@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
This method is called for add new synonym action without selected language . It renders a form to select language for the keyword of new synonym .