@EXT\Route(
"/workspace/team/parameters/{params}/edit/form",
name="claro_team_parameters_edit_form"
)
@EXT\ParamConverter("user", options={"authenticatedUser" = true})
@EXT\Template()

@return \Symfony\Component\HttpFoundation\Response
505680
public function teamParamsEditFormAction(
        WorkspaceTeamParameters $params,
        User $user
    )
    {
        $workspace = $params->getWorkspace();
        $this->checkWorkspaceManager($workspace, $user);
        $form = $this->formFactory->create(new TeamParamsType(), $params);

        return array(
            'form' => $form->createView(),
            'params' => $params,
            'workspace' => $workspace
        );
    }
96429
public function updateAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth($this->resourceCode, $this->getModuleCode(), AccessManager::UPDATE)) {
            return $response;
        }

        // Load object if exist
        if (null !== $object = $this->getExistingObject()) {
            // Hydrate the form abd pass it to the parser
            $changeForm = $this->hydrateObjectForm($object);

            // Pass it to the parser
            $this->getParserContext()->addForm($changeForm);
        }

        // Render the edition template.
        return $this->renderEditionTemplate();
    }
1001855
public function userTeamIndexAction(Team $team, User $currentUser)
    {
        $workspace = $team->getWorkspace();
        $this->checkToolAccess($workspace);
        $isTeamMember = $this->isTeamMember($team, $currentUser);
        $isTeamManager = $this->isTeamManager($team, $currentUser);

        if (!$isTeamMember && !$isTeamManager) {

            throw new AccessDeniedException();
        }
        $users = $team->getUsers();
        $params = $this->teamManager->getParametersByWorkspace($workspace);

        return array(
            'workspace' => $workspace,
            'currentUser' => $currentUser,
            'users' => $users,
            'team' => $team,
            'params' => $params,
            'isTeamMember' => $isTeamMember,
            'isTeamManager' => $isTeamManager
        );
    }
1036366
public function createAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(AdminResources::MODULE, Team::getModuleCode(),
                AccessManager::CREATE)
        ) {
            return $response;
        }

        // Create the Creation Form
        $creationForm = $this->getCreationForm($this->getRequest());

        $con = Propel::getConnection();
        $con->beginTransaction();

        try {
            // Check the form against constraints violations
            $form = $this->validateForm($creationForm, "POST");
            // Get the form field values
            $data = $form->getData();

            $createdObject = $this->getService()->createFromArray($data, $this->getCurrentEditionLocale());


            // Substitute _ID_ in the URL with the ID of the created object
            $successUrl = str_replace('_ID_', $this->getObjectId($createdObject), $creationForm->getSuccessUrl());

            $con->commit();

            // Redirect to the success URL
            return $this->generateRedirect($successUrl);

        } catch (FormValidationException $ex) {
            $con->rollBack();
            // Form cannot be validated
            $error_msg = $this->createStandardFormValidationErrorMessage($ex);
        } catch (\Exception $ex) {
            $con->rollBack();
            // Any other error
            $error_msg = $ex->getMessage();
        }
        if (false !== $error_msg) {
            $this->setupFormErrorContext(
                $this->getTranslator()->trans("%obj creation", ['%obj' => static::CONTROLLER_ENTITY_NAME]),
                $error_msg,
                $creationForm,
                $ex
            );

            // At this point, the form has error, and should be redisplayed.
            return $this->getListRenderTemplate();
        }

    }
1260714
public function processUpdateAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth(AdminResources::MODULE, Team::getModuleCode(),
                AccessManager::UPDATE)
        ) {
            return $response;
        }

        // Error (Default: false)
        $error_msg = false;

        // Create the Form from the request
        $changeForm = $this->getUpdateForm($this->getRequest());


        $con = Propel::getConnection();
        $con->beginTransaction();

        try {
            // Check the form against constraints violations
            $form = $this->validateForm($changeForm, "POST");

            // Get the form field values
            $data = $form->getData();

            $updatedObject = $this->getService()->updateFromArray($data, $this->getCurrentEditionLocale());

            // Check if object exist
            if (!$updatedObject) {
                throw new \LogicException(
                    $this->getTranslator()->trans("No %obj was updated.", ['%obj' => static::CONTROLLER_ENTITY_NAME])
                );
            }

            $con->commit();
            // If we have to stay on the same page, do not redirect to the successUrl,
            // just redirect to the edit page again.
            if ($this->getRequest()->get('save_mode') == 'stay') {
                return $this->redirectToEditionTemplate($this->getRequest());
            }

            // Redirect to the success URL
            return $this->generateSuccessRedirect($changeForm);

        } catch (FormValidationException $ex) {
            $con->rollBack();
            // Form cannot be validated
            $error_msg = $this->createStandardFormValidationErrorMessage($ex);
        } catch (\Exception $ex) {
            $con->rollBack();
            // Any other error
            $error_msg = $ex->getMessage();
        }

        if (false !== $error_msg) {
            // At this point, the form has errors, and should be redisplayed.
            $this->setupFormErrorContext(
                $this->getTranslator()->trans("%obj modification", ['%obj' => static::CONTROLLER_ENTITY_NAME]),
                $error_msg,
                $changeForm,
                $ex
            );

            return $this->getEditRenderTemplate();
        }
    }
1154861
public function teamCreateFormAction(Workspace $workspace, User $user)
    {
        $this->checkWorkspaceManager($workspace, $user);
        $params = $this->teamManager->getParametersByWorkspace($workspace);
        $team = new Team();
        $team->setIsPublic($params->getIsPublic());
        $team->setSelfRegistration($params->getSelfRegistration());
        $team->setSelfUnregistration($params->getSelfUnregistration());

        $form = $this->formFactory->create(new TeamType(), $team);

        return array(
            'form' => $form->createView(),
            'workspace' => $workspace
        );
    }
125363
public function edit(TeamRequest $request, Team $team)
    {
        return $this->response->title(trans('app.edit') . ' ' . trans('team::team.name'))
            ->view('team::team.edit', true)
            ->data(compact('team'))
            ->output();
    }
203891
public function editAction(Request $request, User $userToEdit)
    {
        $form = $this->createForm(UserType::class, $userToEdit);

        $form->handleRequest($request);

        if ($form->isValid()) {

            /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */
            $userManager = $this->get('fos_user.user_manager');
            $userManager->updateUser($userToEdit);

            $this->addFlash(
                'success',
                'The user '.$userToEdit->getNameAndUsername().' was edited successfully.'
            );

            return $this->redirectToRoute('campaignchain_core_user_edit', array('id' => $userToEdit->getId()));
        }

        return $this->render(
            'CampaignChainCoreBundle:User:edit.html.twig',
            array(
                'page_title' => 'Edit User '.$userToEdit->getNameAndUsername(),
                'form' => $form->createView(),
                'form_submit_label' => 'Save',
                'user' => $userToEdit,
            ));
    }
1044118
public function formAction()
    {
        $repository = $this->repositories->get('Applications/Application');
        
        $mode  = $this->params()->fromQuery('mode', 'new');
        $appId = $this->params()->fromQuery('id');
        /* @var \Applications\Entity\Application $application */
        $application = $repository->find($appId);

        $viewModel = new ViewModel();
        if ('edit' == $mode) {
            $comment = $repository->findComment($appId);
        } else {
            $comment = new Comment();
            $comment->setUser($this->auth()->getUser());
        }
        
        $this->acl($application, 'read');
        
        $form = $this->formManager->get('Applications/CommentForm');
        $form->bind($comment);
        
        if ($this->getRequest()->isPost()) {
            $form->setData($_POST);
            
            if ($form->isValid()) {
                if ('new' == $mode) {
                    $application = $repository->find($appId);
                    $application->getComments()->add($comment);
                    $application->changeStatus(
                        $application->getStatus(),
                        sprintf(
                                    /* @translate */ 'Application was rated by %s',
                                     $this->auth()->getUser()->getInfo()->getDisplayName()
                    )
                        );
                }
                $viewModel->setVariable('isSaved', true);
            }
        }
       
        $viewModel->setVariables(
            array(
            'mode' => $mode,
            'identifier' => $appId,
            'commentForm' => $form,
            )
        );
        return $viewModel;
    }
922451
public function edit(Request $request)
    {
        return view('gzero-core::account.edit', [
            'isUserEmailSet' => strpos($request->user()->email, '@'),
            'timezones'      => $this->timezones->getAvailableTimezones()
        ]);
    }
828557
public function form()
    {
        $userModel = config('admin.database.users_model');
        $permissionModel = config('admin.database.permissions_model');
        $roleModel = config('admin.database.roles_model');

        $form = new Form(new $userModel());

        $form->display('id', 'ID');

        if (request()->isMethod('POST')) {
            $userTable = config('admin.database.users_table');
            $userNameRules = "required|unique:{$userTable}";
        } else {
            $userNameRules = 'required';
        }

        $form->text('username', trans('admin.username'))->rules($userNameRules);
        $form->text('name', trans('admin.name'))->rules('required');
        $form->image('avatar', trans('admin.avatar'));
        $form->password('password', trans('admin.password'))->rules('required|confirmed');
        $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
            ->default(function ($form) {
                return $form->model()->password;
            });

        $form->ignore(['password_confirmation']);

        $form->multipleSelect('roles', trans('admin.roles'))->options($roleModel::all()->pluck('name', 'id'));
        $form->multipleSelect('permissions', trans('admin.permissions'))->options($permissionModel::all()->pluck('name', 'id'));

        $form->display('created_at', trans('admin.created_at'));
        $form->display('updated_at', trans('admin.updated_at'));

        $form->saving(function (Form $form) {
            if ($form->password && $form->model()->password != $form->password) {
                $form->password = bcrypt($form->password);
            }
        });

        return $form;
    }
1076435
public function grantAction()
    {
        $params     = $this->params();
        $request    = $this->getRequest();
        $locator    = $this->getServiceLocator();
        $groupModel = $locator->get( 'Grid\User\Model\User\Group\Model' );
        $group      = $groupModel->find( $params->fromRoute( 'id' ) );

        if ( empty( $group ) )
        {
            $this->getResponse()
                 ->setStatusCode( 404 );

            return;
        }

        if ( ! $this->getPermissionsModel()
                    ->isAllowed( $group, 'grant' ) )
        {
            $this->getResponse()
                 ->setStatusCode( 403 );

            return;
        }

        $rightModel = $locator->get( 'Grid\User\Model\User\Right\Model' );
        $rights     = $rightModel->findAllByGroup( $group->id );

        if ( $request->isPost() )
        {
            $data = $request->getPost();

            if ( isset( $data['save'] ) && ! empty( $data['rights'] ) )
            {
                foreach ( $data['rights'] as $rightId => $grant )
                {
                    $rightModel->grantToGroup( $rightId, $group->id, $grant );
                }

                $this->messenger()
                     ->add( 'user.form.grant.success',
                            'user', Message::LEVEL_INFO );

                return $this->redirect()
                            ->toRoute( 'Grid\User\GroupAdmin\List', array(
                                'locale' => (string) $this->locale(),
                            ) );
            }
        }

        return array(
            'group'     => $group,
            'rights'    => $rights,
        );
    }
681572
public function edit($request) {
        $controller=$this->getToplevelController();
        $form=$this->ItemEditForm($this->gridField, $request);
        
        
        return $controller->customise(array(
                                    'Title'=>($this->record && $this->record->ID ? $this->record->Title:sprintf(_t('GridField.NewRecord', 'New %s'), $this->record->i18n_singular_name())),
                                    'ItemEditForm'=>$form,
                                ))->renderWith($this->template);
    }
1159431
protected function _prepareForm()
    {
        $form = $this->formFactory->create();
        $this->setForm($form);

        /** @var \Mirasvit\Blog\Model\Post $post */
        $post = $this->registry->registry('current_model');

        $fieldset = $form->addFieldset('edit_fieldset', [
            'class' => 'blog__post-fieldset'
        ]);

        if ($post->getId()) {
            $fieldset->addField('entity_id', 'hidden', [
                'name'  => 'post[entity_id]',
                'value' => $post->getId(),
            ]);
        }

        $fieldset->addField('name', 'text', [
            'label'    => __('Title'),
            'name'     => 'post[name]',
            'value'    => $post->getName(),
            'required' => true,
        ]);

        $editorConfig = $this->wysiwygConfig->getConfig(['tab_id' => $this->getTabId()]);

        $fieldset->addField('content', 'editor', [
            'name'    => 'post[content]',
            'value'   => $post->getContent(),
            'wysiwyg' => true,
            'style'   => 'height:35em',
            'config'  => $editorConfig,
        ]);

        $fieldset->addField('short_content', 'editor', [
            'label'   => __('Excerpt'),
            'name'    => 'post[short_content]',
            'value'   => $post->getShortContent(),
            'wysiwyg' => true,
            'style'   => 'height:5em',
            'config'  => $editorConfig
        ]);


        return parent::_prepareForm();
    }
627040
public function editAction()
    {
        $id = $this->params()->fromRoute('id');
        if (! is_numeric($id)) {
            $this->flashMessenger()->addMessage(
                $this->scTranslate('The category ID was not specified.')
            );
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }

        try {
            $category = $this->getCategoryService()->getCategory($id);
        } catch (RuntimeException $e) {
            $this->flashMessenger()->addMessage($e->getMessage());
            return $this->redirect()
                ->toRoute('sc-admin/content-manager')
                ->setStatusCode(303);
        }
        $form = $this->getCategoryForm();
        $form->setAttribute(
            'action',
            $this->url()->fromRoute('sc-admin/category/edit', ['id' => $id])
        );
        $form->bind($category);

        if ($this->getRequest()->isPost()) {
            $form->setData($this->getRequest()->getPost());
            if ($form->isValid()) {
                $this->getCategoryService()->saveContent($form->getData());
            }
        }

        return new ViewModel([
            'content' => $category,
            'form' => $form,
        ]);
    }
700320
public function editAction()
    {
        $form = $this->getEditForm();
        $entity = $form->getObject();
        if ($this->getRequest()->isPost()) {
            $data = $this->getRequest()->getPost()->toArray();
            $entityManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
            $hydrator = new DoctrineHydrator($entityManager);
            $hydrator->hydrate($data, $entity);

            if ($form->isValid()) {
                $objectManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
                $objectManager->persist($entity);
                $objectManager->flush();
                $controller = explode('/', $this->getRequest()->getUri()->getPath())[2];
                if (!$this->getRequest()->isXmlHttpRequest()) {
                    return $this->redirect()->toRoute(null, ['controller' => $controller]);
                }
                return;
            } else {
                $this->getResponse()->setStatusCode(400);
            }
        }
        $viewModel = $this->getViewModel();
        $viewModel->setTerminal($this->getRequest()->isXmlHttpRequest());

        return $viewModel->setVariables(['form' => $form]);
    }
834971
public function index()
    {
        $leftandmain = Injector::inst()->create(LeftAndMain::class);

        $form = $this->Form();
        $form->setTemplate($leftandmain->getTemplatesWithSuffix('_EditForm'));
        $form->addExtraClass('cms-edit-form center cms-content');
        $form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
        
        if ($this->request->isAjax()) {
            $response = new HTTPResponse(
                Convert::raw2json(array('Content' => $form->forAjaxTemplate()->getValue()))
            );
            $response->addHeader('X-Pjax', 'Content');
            $response->addHeader('Content-Type', 'text/json');
            $response->addHeader('X-Title', 'SilverStripe - Bulk ' . $this->gridField->list->dataClass . ' Editing');

            return $response;
        } else {
            $controller = $this->getToplevelController();
            return $controller->customise(array('Content' => $form));
        }
    }