private function createPage($page, $options, $models)
    {
        $request = $this->getRequest();
        if ($request->getMethod() == 'POST')
        {
            $data = $request->get('page');
            $page->setModel($data['model']);
        }
        $formClassName = isset($models[$page->getModel()]['back']['form']) ? $models[$page->getModel()]['back']['form'] : '\Fulgurio\LightCMSBundle\Form\Type\AdminPageType';
        $formHandlerClassName = isset($models[$page->getModel()]['back']['handler']) ? $models[$page->getModel()]['back']['handler'] : '\Fulgurio\LightCMSBundle\Form\Handler\AdminPageHandler';
        $formType = new $formClassName($this->container);
        $formType->setModels($models);
        $form = $this->createForm($formType, $page);
        $formHandler = new $formHandlerClassName();
        $formHandler->setForm($form)
                ->setRequest($request)
                ->setDoctrine($this->getDoctrine())
                ->setSlugSuffixSeparator($this->container->getParameter('fulgurio_light_cms.slug_suffix_separator'));
        if ($this->getUser()) {
            $formHandler->setUser($this->getUser());
        }
        if ($formHandler->process($page))
        {
            $this->get('session')->getFlashBag()->add(
                    'success',
                    $this->get('translator')->trans(
                            isset($options['pageId']) ? 'fulgurio.lightcms.pages.edit_form.success_msg' : 'fulgurio.lightcms.pages.add_form.success_msg',
                            array(),
                            'admin'
                    )
            );
            return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $page->getId())));
        }
        $options['form'] = $form->createView();
        if ($this->container->getParameter('fulgurio_light_cms.wysiwyg')
                && $this->container->hasParameter($this->container->getParameter('fulgurio_light_cms.wysiwyg')))
        {
            $options['wysiwyg'] = $this->container->getParameter($this->container->getParameter('fulgurio_light_cms.wysiwyg'));
        }
        if ($page->getParent()&& $page->getParent()->getMetaValue('is_home')
                && $this->container->hasParameter('fulgurio_light_cms.languages'))
        {
            $options['useMultiLang'] = TRUE;
        }
        $templateName = isset($models[$page->getModel()]['back']['template']) ? $models[$page->getModel()]['back']['template'] : 'FulgurioLightCMSBundle:models:standardAdminAddForm.html.twig';
        return $this->render($templateName, $options);
    }
private function createPage($page, $options, $models)
    {
        $request = $this->getRequest();
        if ($request->getMethod() == 'POST')
        {
            $data = $request->get('page');
            $page->setModel($data['model']);
        }
        $formClassName = isset($models[$page->getModel()]['back']['form']) ? $models[$page->getModel()]['back']['form'] : '\Fulgurio\LightCMSBundle\Form\Type\AdminPageType';
        $formHandlerClassName = isset($models[$page->getModel()]['back']['handler']) ? $models[$page->getModel()]['back']['handler'] : '\Fulgurio\LightCMSBundle\Form\Handler\AdminPageHandler';
        $formType = new $formClassName($this->container);
        $formType->setModels($models);
        $form = $this->createForm($formType, $page);
        $formHandler = new $formHandlerClassName();
        $formHandler->setForm($form)
                ->setRequest($request)
                ->setDoctrine($this->getDoctrine())
                ->setSlugSuffixSeparator($this->container->getParameter('fulgurio_light_cms.slug_suffix_separator'));
        if ($this->getUser()) {
            $formHandler->setUser($this->getUser());
        }
        if ($formHandler->process($page))
        {
            $this->get('session')->getFlashBag()->add(
                    'success',
                    $this->get('translator')->trans(
                            isset($options['pageId']) ? 'fulgurio.lightcms.pages.edit_form.success_msg' : 'fulgurio.lightcms.pages.add_form.success_msg',
                            array(),
                            'admin'
                    )
            );
            return $this->redirect($this->generateUrl('AdminPagesSelect', array('pageId' => $page->getId())));
        }
        $options['form'] = $form->createView();
        if ($this->container->getParameter('fulgurio_light_cms.wysiwyg')
                && $this->container->hasParameter($this->container->getParameter('fulgurio_light_cms.wysiwyg')))
        {
            $options['wysiwyg'] = $this->container->getParameter($this->container->getParameter('fulgurio_light_cms.wysiwyg'));
        }
        if ($page->getParent()&& $page->getParent()->getMetaValue('is_home')
                && $this->container->hasParameter('fulgurio_light_cms.languages'))
        {
            $options['useMultiLang'] = TRUE;
        }
        $templateName = isset($models[$page->getModel()]['back']['template']) ? $models[$page->getModel()]['back']['template'] : 'FulgurioLightCMSBundle:models:standardAdminAddForm.html.twig';
        return $this->render($templateName, $options);
    }
private function createPage ( $ page , $ options , $ models ) { $ request = $ this -> getRequest ( ) ; if ( $ request -> getMethod ( ) == 'POST' ) { $ data = $ request -> get ( 'page' ) ; $ page -> setModel ( $ data [ 'model' ] ) ; } $ formClassName = isset ( $ models [ $ page -> getModel ( ) ] [ 'back' ] [ 'form' ] ) ? $ models [ $ page -> getModel ( ) ] [ 'back' ] [ 'form' ] : '\Fulgurio\LightCMSBundle\Form\Type\AdminPageType' ; $ formHandlerClassName = isset ( $ models [ $ page -> getModel ( ) ] [ 'back' ] [ 'handler' ] ) ? $ models [ $ page -> getModel ( ) ] [ 'back' ] [ 'handler' ] : '\Fulgurio\LightCMSBundle\Form\Handler\AdminPageHandler' ; $ formType = new $ formClassName ( $ this -> container ) ; $ formType -> setModels ( $ models ) ; $ form = $ this -> createForm ( $ formType , $ page ) ; $ formHandler = new $ formHandlerClassName ( ) ; $ formHandler -> setForm ( $ form ) -> setRequest ( $ request ) -> setDoctrine ( $ this -> getDoctrine ( ) ) -> setSlugSuffixSeparator ( $ this -> container -> getParameter ( 'fulgurio_light_cms.slug_suffix_separator' ) ) ; if ( $ this -> getUser ( ) ) { $ formHandler -> setUser ( $ this -> getUser ( ) ) ; } if ( $ formHandler -> process ( $ page ) ) { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , $ this -> get ( 'translator' ) -> trans ( isset ( $ options [ 'pageId' ] ) ? 'fulgurio.lightcms.pages.edit_form.success_msg' : 'fulgurio.lightcms.pages.add_form.success_msg' , array ( ) , 'admin' ) ) ; return $ this -> redirect ( $ this -> generateUrl ( 'AdminPagesSelect' , array ( 'pageId' => $ page -> getId ( ) ) ) ) ; } $ options [ 'form' ] = $ form -> createView ( ) ; if ( $ this -> container -> getParameter ( 'fulgurio_light_cms.wysiwyg' ) && $ this -> container -> hasParameter ( $ this -> container -> getParameter ( 'fulgurio_light_cms.wysiwyg' ) ) ) { $ options [ 'wysiwyg' ] = $ this -> container -> getParameter ( $ this -> container -> getParameter ( 'fulgurio_light_cms.wysiwyg' ) ) ; } if ( $ page -> getParent ( ) && $ page -> getParent ( ) -> getMetaValue ( 'is_home' ) && $ this -> container -> hasParameter ( 'fulgurio_light_cms.languages' ) ) { $ options [ 'useMultiLang' ] = TRUE ; } $ templateName = isset ( $ models [ $ page -> getModel ( ) ] [ 'back' ] [ 'template' ] ) ? $ models [ $ page -> getModel ( ) ] [ 'back' ] [ 'template' ] : 'FulgurioLightCMSBundle:models:standardAdminAddForm.html.twig' ; return $ this -> render ( $ templateName , $ options ) ; }
Create form for page entity, use for edit or add page

@param Page $page
@param array $options
@param array $models
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
Create form for page entity use for edit or add page