Displays a form to edit an existing Located entity.

@Route("/{id}/edit")
@Method({"GET", "POST"})
@Template()
559567
public function editAction(Request $request, Located $located)
    {
        
        $deleteForm = $this->createDeleteForm($located);
        $editForm = $this->createForm('EcommerceBundle\Form\LocatedType', $located, array(
            'action' => $this->generateUrl('ecommerce_located_edit', array('id' => $located->getId())),
            'method' => 'POST',
        ));
        $editForm->handleRequest($request);

        if ($editForm->isSubmitted() && $editForm->isValid()) {
            $em = $this->getDoctrine()->getManager();
            
            $em->persist($located);
            $em->flush();
            
            $this->get('session')->getFlashBag()->add('success', 'located.edited');
            
            return $this->redirectToRoute('ecommerce_located_show', array('id' => $located->getId()));
        }

        return array(
            'entity' => $located,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
778287
public function editAction($id)
        {

            /** @var RemoteApp $oRemoteApp */
            $oRemoteApp = RemoteAppQuery::create()->findOneById($id);

            if (count($oRemoteApp) === 0) {
                throw $this->createNotFoundException('Unable to find RemoteApp entity.');
            }

            $editForm   = $this->createEditForm($oRemoteApp);
            $deleteForm = $this->createDeleteForm($id);

            return $this->render('SlashworksAppBundle:RemoteApp:edit.html.twig', array(
                'entity'      => $oRemoteApp,
                'edit_form'   => $editForm->createView(),
                'delete_form' => $deleteForm->createView(),
            ));
        }
646525
public function edit($id)
    {
        $record = $this->model->findOrFail($id);

        $this->viewData['record'] = $record;

        $this->viewData['formMethod'] = 'PUT';
        $this->viewData['formAction'] = 'user.update';

        return view($this->defaultFormView, $this->viewData);
    }
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);
    }
1251028
public function editAction($id, Request $request)
    {
        $contentType = $this->contentTypeManager->getContentTypeById($id);

        if ($contentType === null) {
            throw EntityNotFoundException::fromClassNameAndIdentifier(
                $this->configurationManager->getEntityClass('content_type'),
                [$id]
            );
        }

        $fieldTypes = [];
        foreach ($contentType->getFields() as $field) {
            $fieldTypes[$field->getId()] = $field->getType();
        }

        $form = $this->createForm(ContentTypeFormType::class, $contentType, [
            'action' => $this->generateUrl('sherlockode_acb_content_type_edit', ['id' => $contentType->getId()]),
            'attr' => [
                'data-change-type-url' => $this->generateUrl('sherlockode_acb_content_type_change_field_type'),
                'class' => 'edit-content-type'
            ],
            'contentType' => $contentType,
        ]);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $this->contentTypeManager->processFieldsChangeType($contentType, $fieldTypes);
            $this->om->flush();

            return $this->redirectToRoute('sherlockode_acb_content_type_edit', ['id' => $contentType->getId()]);
        }

        return $this->render('@SherlockodeAdvancedContent/ContentType/edit_content_type.html.twig', [
            'form' => $form->createView(),
            'data' => $contentType,
        ]);
    }
439231
public function edit(int $id)
    {
        try {
            $address = Auth::user()->findAddress($id);
        } catch(\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
            return $this->respondsWithError(trans('address.errors.model_not_found'));
        }

        return view('address.form_edit', compact('address'));
    }
935513
public function EditForm($request = null) {
		HtmlEditorField::include_js();

		$cur = $this->getCurrentPageID();
		if ($cur) {
			$record = $this->currentPage();
			if (!$record)
				return false;
			if ($record && !$record->canView())
				return Security::permissionFailure($this);
		}

		if ($this->hasMethod('getEditForm')) {
			return $this->getEditForm($this->getCurrentPageID());
		}

		return false;
	}
1240335
public function edit($id)
    {
        $blog = $this->repository->find($id);

        if (empty($blog)) {
            Cms::notification('Blog not found', 'warning');

            return redirect(route($this->routeBase.'.blog.index'));
        }

        return view('cms::modules.blogs.edit')->with('blog', $blog);
    }
1122753
public function createEditForm($id) {
        $entity = $this->read_handler->get($id);
        $edit_form = $this->form_factory->create(new Type(), $entity);

        return $edit_form;
    }
1261817
public function edit(Request $request, $id)
    {
        $currentUser = $this->getUser();
        $userEntity = $this->getUserEntity($id);
        if ($userEntity === false) {
            return $this->redirectToRoute('users');
        }
        /** @var Permissions $permissions */
        $permissions = $this->app['permissions'];
        $availableRoles = array_flip(array_map(
            function ($role) {
                return $role['label'];
            },
            $permissions->getDefinedRoles()
        ));
        $mutableRoles = $permissions->getManipulatableRoles($currentUser->toArray());

        $formOptions = [
            'password' => [
                'required' => !$userEntity->getId()
            ],
            'roles'    => [
                'choices' => $availableRoles,
                'mutable' => $mutableRoles,
            ],
        ];

        // Generate the form
        $form = $this->createFormBuilder(FormType\UserEditType::class, $userEntity, $formOptions)
            ->getForm()
            ->handleRequest($request)
        ;

        if ($form->isSubmitted() && $form->isValid()) {
            /** @var \Bolt\Form\FormType\UserData $data */
            $data = $form->getData();
            $roleMutator = new ListMutator($availableRoles, $mutableRoles);
            $data->applyToEntity($userEntity, $roleMutator);

            $saved = $this->getRepository(Entity\Users::class)->save($userEntity);
            if ($saved) {
                $this->flashes()->success(Trans::__('page.edit-users.message.user-saved', ['%user%' => $userEntity->getDisplayname()]));
                $this->app['logger.system']->info(
                    Trans::__('page.edit-users.log.user-updated', ['%user%' => $userEntity->getDisplayname()]),
                    ['event' => 'security']
                );
            } else {
                $this->flashes()->error(Trans::__('page.edit-users.message.saving-user', ['%user%' => $userEntity->getDisplayname()]));
            }

            if ($userEntity !== false && $userEntity->getId() === $currentUser->getId() && $userEntity->getUsername() !== $currentUser->getUsername()) {
                // If the current user changed their own login name, the session
                // is effectively invalidated. If so, we must redirect to the
                // login page with a flash message.
                $this->flashes()->error(Trans::__('page.edit-users.message.change-self'));

                return $this->redirectToRoute('login');
            } elseif ($userEntity !== false) {
                // Return to the 'Edit users' screen.
                return $this->redirectToRoute('users');
            }
        }

        $context = [
            'kind'        => $id ? 'edit' : 'create',
            'form'        => $form->createView(),
            'note'        => '',
            'displayname' => $userEntity->getDisplayname(),
        ];

        return $this->render('@bolt/edituser/edituser.twig', $context);
    }
10256
public function editAction(Request $request, $id)
    {
        $formManager = $this->get('opifer.form.form_manager');
        $em = $this->get('doctrine.orm.entity_manager');

        $form = $formManager->getRepository()->find($id);

        if (!$form) {
            return $this->createNotFoundException();
        }

        $originalAttributes = new ArrayCollection();
        foreach ($form->getSchema()->getAttributes() as $attributes) {
            $originalAttributes->add($attributes);
        }

        $formType = $this->createForm(FormType::class, $form);
        $formType->handleRequest($request);

        if ($formType->isSubmitted() && $formType->isValid()) {
            // Remove deleted attributes
            foreach ($originalAttributes as $attribute) {
                if (false === $form->getSchema()->getAttributes()->contains($attribute)) {
                    $em->remove($attribute);
                }
            }

            // Add new attributes
            foreach ($formType->getData()->getSchema()->getAttributes() as $attribute) {
                $attribute->setSchema($form->getSchema());

                foreach ($attribute->getOptions() as $option) {
                    $option->setAttribute($attribute);
                }
            }

            $formManager->save($form);

            $this->addFlash('success', 'Event has been updated successfully');

            return $this->redirectToRoute('opifer_form_form_edit', ['id' => $form->getId()]);
        }

        return $this->render($this->getParameter('opifer_form.form_edit_view'), [
            'form' => $form,
            'form_form' => $formType->createView(),
        ]);
    }
931759
public function addAction() {

        $edit_form = $this->container->get("haven_core.category.form_handler")->createNewForm();

        $request = $this->container->get('request_modifier')->setRequest($this->container->get("request"))
                ->slug(array("name"))
                ->getRequest();

        $edit_form->bind($request);

        if ($edit_form->isValid()) {
            $this->container->get("haven_core.category.persistence_handler")->save($edit_form->getData());
            $this->container->get("session")->getFlashBag()->add("success", "create.success");

            return new RedirectResponse($this->container->get('router')->generate(str_replace('update', "list", $this->container->get("request")->get("_route"))));
        }

        $this->container->get("session")->getFlashBag()->add("error", "create.error");

        $template = str_replace(":create.html.twig", ":new.html.twig", $this->container->get("request")->get('_template'));
        $params = array(
            'edit_form' => $edit_form->createView()
        );

        return new Response($this->container->get('templating')->render($template, $params));
    }
8034
public function editAction()
    {
        /* @var $user \Auth\Entity\User */
        $user = $this->userRepository->find($this->params('id'), \Doctrine\ODM\MongoDB\LockMode::NONE, null, ['allowDeactivated' => true]);
        
        // check if user is not found
        if (!$user) {
            return $this->notFoundAction();
        }
        
        $params = $this->params();
        $forms = $this->formManager;
        /* @var $infoContainer \Auth\Form\UserProfileContainer */
        $infoContainer = $forms->get('Auth/UserProfileContainer');
        $infoContainer->setEntity($user);
        $statusContainer = $forms->get('Auth/UserStatusContainer');
        $statusContainer->setEntity($user);
        
        // set selected user to image strategy
        $imageStrategy = $infoContainer->getForm('info.image')
            ->getHydrator()
            ->getStrategy('image');
		$fileEntity = $imageStrategy->getFileEntity();
		$fileEntity->setUser($user);
		$imageStrategy->setFileEntity($fileEntity);
        
        if ($this->request->isPost()) {
            $formName = $params->fromQuery('form');
            $container = $formName === 'status' ? $statusContainer : $infoContainer;
            $form = $container->getForm($formName);
        
            if ($form) {
                $postData  = $form->getOption('use_post_array') ? $params->fromPost() : [];
                $filesData = $form->getOption('use_files_array') ? $params->fromFiles() : [];
                $form->setData(array_merge($postData, $filesData));
        
                if (!$form->isValid()) {
                    return new JsonModel(
                        array(
                            'valid' => false,
                            'errors' => $form->getMessages(),
                        )
                    );
                }
                
                $this->userRepository->store($user);
        
                if ('file-uri' === $params->fromPost('return')) {
                    $content = $form->getHydrator()->getLastUploadedFile()->getUri();
                } else {
                    if ($form instanceof SummaryFormInterface) {
                        $form->setRenderMode(SummaryFormInterface::RENDER_SUMMARY);
                        $viewHelper = 'summaryForm';
                    } else {
                        $viewHelper = 'form';
                    }
                    $content = $this->viewHelper->get($viewHelper)->__invoke($form);
                }
        
                return new JsonModel(
                    array(
                        'valid' => $form->isValid(),
                        'content' => $content,
                    )
                );
            }
        }
        
        return [
            'infoContainer' => $infoContainer,
            'statusContainer' => $statusContainer
        ];
    }
117991
def edit_post(request, post_id):
    
    post   = get_object_or_404(Post, id=post_id)
    user   = request.user

    topic  = post.topic
    # oughta build a get_absolute_url method for this, maybe.
    post_url = '{0}page{1}/#post{2}'.format(topic.get_short_url(), topic.page_count, post.id)

    if topic.is_locked:
        messages.error(request, 'Sorry, but this topic is closed')
        return HttpResponseRedirect(post_url)

    if user.is_staff is False and user.id != post.author.id:
        messages.error(request, "Sorry, but you can't edit this post.")
        return HttpResponseRedirect(post_url)

    if request.POST and len(request.POST['text']) > 1:
        if request.is_ajax and 'body' in request.POST:  # AJAX REQUEST
            post.text = request.POST['body']
            post.save(update_fields=['text', 'text_formatted'])
            return HttpResponse(str(post.text))
        post.text = request.POST['text']
        post.save(update_fields=['text', 'text_formatted'])

        if 'name' in request.POST:  # updated topic
            topic.name = request.POST['name']
            topic.save(update_fields=['name'])
        return HttpResponseRedirect(post_url)
    # this is a get request
    else:
        if post == topic.post_set.all()[0]:
            form = AddTopicForm(instance=topic, initial={'text': post.text})
        else:
            form = PostForm(instance=post)
        return render(request, 'fretboard/add_edit.html', {
            'quote': post.quote,
            'form' : form,
            'form_title': 'Edit post',
        })
650401
protected function manageEdit($entity, Request $request, $formTypeFQCN)
    {
        $form = $this->createForm($formTypeFQCN, $entity, array(
            'action' => $this->getEditUrl($entity),
            'method' => 'POST',
        ));

        $form
            ->add('save', SubmitType::class, array('attr' => array('class' => 'btn btn-primary')))
            ->add('delete', SubmitType::class, array('attr' => array('class' => 'btn btn-danger')));

        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            if ($form->get('save')->isClicked()) {
                if ($form->isValid()) {
                    return $this->crudManage($entity, AdminCrudEvent::UPDATE);
                }
            } elseif ($form->get('delete')->isClicked()) {
                return $this->crudManage($entity, AdminCrudEvent::DELETE);
            }
        }

        return $this->render(
            $this->getEditTemplate(),
            array(
                'entity' => $entity,
                'form' => $form->createView(),
            ));
    }
567439
public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $user = $em->getRepository('ChillMainBundle:User')->find($id);

        if (!$user) {
            throw $this->createNotFoundException('Unable to find User entity.');
        }

        $editForm = $this->createEditForm($user);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            return $this->redirect($this->generateUrl('admin_user_edit', array('id' => $id)));
        }

        return $this->render('ChillMainBundle:User:edit.html.twig', array(
            'entity'      => $user,
            'edit_form'   => $editForm->createView(),
            'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($user)->createView(),
            'delete_groupcenter_form' => array_map( 
                    function(\Symfony\Component\Form\Form $form) {
                        return $form->createView();
                
                    },
                    iterator_to_array($this->getDeleteLinkGroupCenterByUser($user), true))
        ));
    }
562308
public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $center = $em->getRepository('ChillMainBundle:Center')->find($id);

        if (!$center) {
            throw $this->createNotFoundException('Unable to find Center entity.');
        }

        $editForm = $this->createEditForm($center);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            return $this->redirect($this->generateUrl('admin_center_edit', array('id' => $id)));
        }

        return $this->render('ChillMainBundle:Center:edit.html.twig', array(
            'entity'      => $center,
            'edit_form'   => $editForm->createView()
        ));
    }