public function editAction(Request $request)
    {
        $this->isGranted('EDIT');

        $this->container->get('ekyna_admin.menu.builder')
            ->breadcrumbAppend('settings', 'ekyna_setting.parameter.label.plural');

        $manager = $this->getSettingsManager();
        $schemas = $this->getSettingsRegistry()->getSchemas();

        $settings = [];
        $builder = $this
            ->createFormBuilder(null, [
                'data_class' => null,
                'admin_mode' => true,
                'cascade_validation' => true,
            ])
            ->add('actions', 'form_actions', [
                'buttons' => [
                    'save' => [
                        'type' => 'submit', 'options' => [
                            'button_class' => 'primary',
                            'label' => 'ekyna_core.button.save',
                            'attr' => [
                                'icon' => 'ok',
                            ],
                        ],
                    ],
                    'cancel' => [
                        'type' => 'button', 'options' => [
                            'label' => 'ekyna_core.button.cancel',
                            'button_class' => 'default',
                            'as_link' => true,
                            'attr' => [
                                'class' => 'form-cancel-btn',
                                'icon' => 'remove',
                                'href' => $this->generateUrl('ekyna_setting_parameter_admin_show'),
                            ],
                        ],
                    ],
                ],
            ])
        ;
        foreach($schemas as $namespace => $schema) {
            $builder->add($namespace, $schema);
            $settings[$namespace] = $manager->loadSettings($namespace);
        }

        $form = $builder
            ->getForm()
            ->setData($settings)
        ;

        if ($request->isMethod('POST') && $form->handleRequest($request)->isValid()) {
            $messageType = 'success';
            try {
                foreach($schemas as $namespace => $schema) {
                    $manager->saveSettings($namespace, $form->get($namespace)->getData());
                }
                $message = $this->getTranslator()->trans('ekyna_setting.parameter.flash.edit');
            } catch (ValidatorException $exception) {
                $message = $this->getTranslator()->trans($exception->getMessage(), [], 'validators');
                $messageType = 'danger';
            }
            $this->addFlash($message, $messageType);

            return $this->redirect($this->generateUrl('ekyna_setting_parameter_admin_show'));
        }

        return $this->render('EkynaSettingBundle:Settings:edit.html.twig', [
            'labels'     => $manager->getLabels(),
            'templates'  => $manager->getFormTemplates(),
            'form'       => $form->createView(),
        ]);
    }
public function editAction(Request $request)
    {
        $this->isGranted('EDIT');

        $this->container->get('ekyna_admin.menu.builder')
            ->breadcrumbAppend('settings', 'ekyna_setting.parameter.label.plural');

        $manager = $this->getSettingsManager();
        $schemas = $this->getSettingsRegistry()->getSchemas();

        $settings = [];
        $builder = $this
            ->createFormBuilder(null, [
                'data_class' => null,
                'admin_mode' => true,
                'cascade_validation' => true,
            ])
            ->add('actions', 'form_actions', [
                'buttons' => [
                    'save' => [
                        'type' => 'submit', 'options' => [
                            'button_class' => 'primary',
                            'label' => 'ekyna_core.button.save',
                            'attr' => [
                                'icon' => 'ok',
                            ],
                        ],
                    ],
                    'cancel' => [
                        'type' => 'button', 'options' => [
                            'label' => 'ekyna_core.button.cancel',
                            'button_class' => 'default',
                            'as_link' => true,
                            'attr' => [
                                'class' => 'form-cancel-btn',
                                'icon' => 'remove',
                                'href' => $this->generateUrl('ekyna_setting_parameter_admin_show'),
                            ],
                        ],
                    ],
                ],
            ])
        ;
        foreach($schemas as $namespace => $schema) {
            $builder->add($namespace, $schema);
            $settings[$namespace] = $manager->loadSettings($namespace);
        }

        $form = $builder
            ->getForm()
            ->setData($settings)
        ;

        if ($request->isMethod('POST') && $form->handleRequest($request)->isValid()) {
            $messageType = 'success';
            try {
                foreach($schemas as $namespace => $schema) {
                    $manager->saveSettings($namespace, $form->get($namespace)->getData());
                }
                $message = $this->getTranslator()->trans('ekyna_setting.parameter.flash.edit');
            } catch (ValidatorException $exception) {
                $message = $this->getTranslator()->trans($exception->getMessage(), [], 'validators');
                $messageType = 'danger';
            }
            $this->addFlash($message, $messageType);

            return $this->redirect($this->generateUrl('ekyna_setting_parameter_admin_show'));
        }

        return $this->render('EkynaSettingBundle:Settings:edit.html.twig', [
            'labels'     => $manager->getLabels(),
            'templates'  => $manager->getFormTemplates(),
            'form'       => $form->createView(),
        ]);
    }
public function editAction ( Request $ request ) { $ this -> isGranted ( 'EDIT' ) ; $ this -> container -> get ( 'ekyna_admin.menu.builder' ) -> breadcrumbAppend ( 'settings' , 'ekyna_setting.parameter.label.plural' ) ; $ manager = $ this -> getSettingsManager ( ) ; $ schemas = $ this -> getSettingsRegistry ( ) -> getSchemas ( ) ; $ settings = [ ] ; $ builder = $ this -> createFormBuilder ( null , [ 'data_class' => null , 'admin_mode' => true , 'cascade_validation' => true , ] ) -> add ( 'actions' , 'form_actions' , [ 'buttons' => [ 'save' => [ 'type' => 'submit' , 'options' => [ 'button_class' => 'primary' , 'label' => 'ekyna_core.button.save' , 'attr' => [ 'icon' => 'ok' , ] , ] , ] , 'cancel' => [ 'type' => 'button' , 'options' => [ 'label' => 'ekyna_core.button.cancel' , 'button_class' => 'default' , 'as_link' => true , 'attr' => [ 'class' => 'form-cancel-btn' , 'icon' => 'remove' , 'href' => $ this -> generateUrl ( 'ekyna_setting_parameter_admin_show' ) , ] , ] , ] , ] , ] ) ; foreach ( $ schemas as $ namespace => $ schema ) { $ builder -> add ( $ namespace , $ schema ) ; $ settings [ $ namespace ] = $ manager -> loadSettings ( $ namespace ) ; } $ form = $ builder -> getForm ( ) -> setData ( $ settings ) ; if ( $ request -> isMethod ( 'POST' ) && $ form -> handleRequest ( $ request ) -> isValid ( ) ) { $ messageType = 'success' ; try { foreach ( $ schemas as $ namespace => $ schema ) { $ manager -> saveSettings ( $ namespace , $ form -> get ( $ namespace ) -> getData ( ) ) ; } $ message = $ this -> getTranslator ( ) -> trans ( 'ekyna_setting.parameter.flash.edit' ) ; } catch ( ValidatorException $ exception ) { $ message = $ this -> getTranslator ( ) -> trans ( $ exception -> getMessage ( ) , [ ] , 'validators' ) ; $ messageType = 'danger' ; } $ this -> addFlash ( $ message , $ messageType ) ; return $ this -> redirect ( $ this -> generateUrl ( 'ekyna_setting_parameter_admin_show' ) ) ; } return $ this -> render ( 'EkynaSettingBundle:Settings:edit.html.twig' , [ 'labels' => $ manager -> getLabels ( ) , 'templates' => $ manager -> getFormTemplates ( ) , 'form' => $ form -> createView ( ) , ] ) ; }
Edit the parameters.

@param Request $request
@return \Symfony\Component\HttpFoundation\Response
Edit the parameters .