Displays a form to edit an existing MenuItem entity.

@Route("/menuitemlabel/{id}/edit", name="admin_menu_item_label_edit")
@Method("GET")
@Template("FlowcodePageBundle:AdminMenu:edit_itemmenu_label.html.twig")
554324
public function editMenuItemLabelAction(MenuItemLabel $menuItemlabel)
    {
        $em = $this->getDoctrine()->getManager();

        if (!$menuItemlabel) {
            throw $this->createNotFoundException('Unable to find MenuItem entity.');
        }
        $editForm = $this->createForm($this->get("amulen.page.form.menuitemlabel"), $menuItemlabel, array(
            'action' => $this->generateUrl('admin_menu_item_label_update', array('id' => $menuItemlabel->getId())),
            'method' => 'PUT',
        ));
        $editForm->add('submit', 'submit', array('label' => 'Update'));

        return array(
            'entity' => $menuItemlabel,
            'form' => $editForm->createView(),
        );
    }
230694
private function createLinkManagerMenuItem(): ?ItemInterface
    {
        if (!$this->permissionResolver->hasAccess('url', 'view')) {
            return null;
        }

        return $this->factory->createItem(
            self::ITEM_CONTENT__LINK_MANAGER,
            [
                'route' => 'ezplatform.link_manager.list',
                'extras' => [
                    'routes' => [
                        'edit' => 'ezplatform.link_manager.edit',
                        'view' => 'ezplatform.link_manager.view',
                    ],
                ],
            ]
        );
    }
35958
public function actionEdit ()
		{
			$id = Yii::$app->request->get('id');
			$menu = Menu::findOne($id);
			if ($menu == null)
			{
				Yii::$app->notification->messageToSession(Yii::tr('Menu item not found.', [], 'menu'));
				$this->redirect(Yii::$app->request->referrer);
			}
			if (Yii::$app->request->isPost)
			{
				$post = Yii::$app->request->post('Menu');

				$menu->updateAttributes([
					'title' => $post[ 'title' ],
					'url'   => $post[ 'url' ],
					'path'  => $post[ 'path' ]
				]);

				$menu->save();
				Yii::$app->notification->messageToSession(Yii::tr('Menu item was saved.', [], 'menu'));
				$this->redirect(Url::toRoute([ '/menu/index', 'type' => $menu->typeID ]));
			}
			$this->data('model', $menu);
			$this->setTitle(Yii::tr('Edit menu item', [], 'menu'));
			$this->_tpl = '@menuViews/add';
		}
5951
public function editAction($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);

        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))
        ));
    }
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
        ];
    }
414397
public function editItem($id)
    {
        $this->request->allowMethod(['get', 'put']);

        $menuItem = $this->MenuItems->get($id);
        if ($this->request->is('put') && !empty($this->request->data)) {
            $menuItem = $this->MenuItems->patchEntity($menuItem, $this->request->data);
            if ($this->MenuItems->save($menuItem)) {
                $this->Flash->success(__d('wasabi_core', 'Menu Item <strong>{0}</strong> has been updated.', $this->request->data['name']));
                $this->redirect(['action' => 'edit', $menuItem->get('menu_id')]);
                return;
            } else {
                $this->Flash->error($this->formErrorMessage);
            }
        }
        $this->set([
            'menu' => $this->Menus->get($menuItem->get('menu_id')),
            'menuItem' => $menuItem,
            'linkTypes' => $this->Menus->getLinkTypes()
        ]);
        $this->render('add_item');
    }
1075247
public function editAction()
    {
        if ($form = $this->processForm()) {
            if ($this->useTabbedForms && method_exists($this, 'getSubject')) {
                $data = $this->getModel()->loadFirst();
                $subject = $this->getSubject($data);
                $this->setPageTitle(sprintf($this->_('Edit %s %s'), $this->getTopic(1), $subject));
            } else {
                $this->setPageTitle(sprintf($this->_('Edit %s'), $this->getTopic(1)));
            }
            $this->html[] = $form;
        }
    }
269251
def _modifyItemTag(self, item_id, action, tag):
        
        return self.httpPost(ReaderUrl.EDIT_TAG_URL,
                             {'i': item_id, action: tag, 'ac': 'edit-tags'})
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);
    }
913810
public function ItemEditForm() {
        $list=$this->gridField->getList();
        
        if(empty($this->record)) {
            $controller=$this->getToplevelController();
            $noActionURL=$controller->removeAction($_REQUEST['url']);
            
            $controller->getResponse()->removeHeader('Location');   //clear the existing redirect
            
            return $controller->redirect($noActionURL, 302);
        }

        $canView=$this->record->canView();
        $canEdit=$this->record->canEdit();
        $canDelete=$this->record->canDelete();
        $canCreate=$this->record->canCreate();

        if(!$canView) {
            return $this->getToplevelController()->httpError(403);
        }
        
        $actions=new FieldList();
        if($this->record->ID!==0) {
            if($canEdit) {
                $actions->push(FormAction::create('doSave', _t('GridFieldDetailForm.Save', 'Save'))
                                                ->setUseButtonTag(true)
                                                ->addExtraClass('ss-ui-action-constructive')
                                                ->setAttribute('data-icon', 'accept'));
            }
            
            if($canDelete) {
                $actions->push(FormAction::create('doDelete', _t('GridFieldDetailForm.Delete', 'Delete'))
                                                ->setUseButtonTag(true)
                                                ->addExtraClass('ss-ui-action-destructive action-delete'));
            }
        }else { // adding new record
            //Change the Save label to 'Create'
            $actions->push(FormAction::create('doSave', _t('GridFieldDetailForm.Create', 'Create'))
                                            ->setUseButtonTag(true)
                                            ->addExtraClass('ss-ui-action-constructive')
                                            ->setAttribute('data-icon', 'add'));
            
            // Add a Cancel link which is a button-like link and link back to one level up.
            $curmbs = $this->Breadcrumbs();
            if($curmbs && $curmbs->count()>=2){
                $one_level_up = $curmbs->offsetGet($curmbs->count()-2);
                $text=sprintf(
                    "<a class=\"%s\" href=\"%s\">%s</a>",
                    "crumb ss-ui-button ss-ui-action-destructive cms-panel-link ui-corner-all", // CSS classes
                    $one_level_up->Link, // url
                    _t('GridFieldDetailForm.CancelBtn', 'Cancel') // label
                );
                
                $actions->push(new LiteralField('cancelbutton', $text));
            }
        }
        
        // If we are creating a new record in a has-many list, then
        // pre-populate the record's foreign key.
        if($list instanceof HasManyList && !$this->record->isInDB()) {
            $key=$list->getForeignKey();
            $id=$list->getForeignID();
            $this->record->$key=$id;
        }
        
        $fields=$this->component->getFields();
        if(!$fields) {
            $fields=($this->record->hasMethod('getFrontEndFields') ? $this->record->getFrontEndFields():$this->record->getCMSFields());
        }
        
        // If we are creating a new record in a has-many list, then
        // Disable the form field as it has no effect.
        if($list instanceof HasManyList) {
            $key=$list->getForeignKey();
            
            if($field=$fields->dataFieldByName($key)) {
                $fields->makeFieldReadonly($field);
            }
        }
        
        // this pushes the current page ID in as a hidden field
        // this means the request will have the current page ID in it
        // rather than relying on session which can have been rewritten
        // by the user having another tab open
        // see LeftAndMain::currentPageID
        if($this->controller->hasMethod('currentPageID') && $this->controller->currentPageID()) {
            $fields->push(new HiddenField('CMSMainCurrentPageID', null, $this->controller->currentPageID()));
        }
        
        // Caution: API violation. Form expects a Controller, but we are giving it a RequestHandler instead.
        // Thanks to this however, we are able to nest GridFields, and also access the initial Controller by
        // dereferencing GridFieldDetailForm_ItemRequest->getController() multiple times. See getToplevelController
        // below.
        $form=new Form(
            $this,
            'ItemEditForm',
            $fields,
            $actions,
            $this->component->getValidator()
        );
        
        $form->loadDataFrom($this->record, ($this->record->ID==0 ? Form::MERGE_IGNORE_FALSEISH:Form::MERGE_DEFAULT));
        
        if($this->record->ID && !$canEdit) {
            // Restrict editing of existing records
            $form->makeReadonly();
            
            // Hack to re-enable delete button if user can delete
            if($canDelete) {
                $form->Actions()->fieldByName('action_doDelete')->setReadonly(false);
            }
        }else if(!$this->record->ID && !$canCreate) {
            // Restrict creation of new records
            $form->makeReadonly();
        }
        
        // Load many_many extraData for record.
        // Fields with the correct 'ManyMany' namespace need to be added manually through getCMSFields().
        if($list instanceof ManyManyList) {
            $extraData=$list->getExtraData('', $this->record->ID);
            $form->loadDataFrom(array('ManyMany' => $extraData));
        }
        
        $cb=$this->component->getItemEditFormCallback();
        if($cb) {
            $cb($form, $this);
        }
        
        $this->extend("updateItemEditForm", $form);
        return $form;
    }
82862
public function indexAction(Request $request, $menuid)
    {
        $menuRepo = $this->getDoctrine()->getManager()->getRepository(
            $this->container->getParameter('kunstmaan_menu.entity.menu.class')
        );

        /** @var BaseMenu $menu */
        $menu = $menuRepo->find($menuid);
        if ($menu->getLocale() != $request->getLocale()) {
            /** @var BaseMenu $translatedMenu */
            $translatedMenu = $menuRepo->findOneBy(['locale' => $request->getLocale(), 'name' => $menu->getName()]);
            $menuid = $translatedMenu->getId();
        }

        $configurator = $this->getAdminListConfigurator($request, $menuid);
        $itemRoute = function (EntityInterface $item) use ($menuid) {
            return array(
                'path' => 'kunstmaanmenubundle_admin_menuitem_move_up',
                'params' => array(
                    'menuid' => $menuid,
                    'item' => $item->getId(),
                ),
            );
        };
        $configurator->addItemAction(new SimpleItemAction($itemRoute, 'arrow-up', 'kuma_admin_list.action.move_up'));

        $itemRoute = function (EntityInterface $item) use ($menuid) {
            return array(
                'path' => 'kunstmaanmenubundle_admin_menuitem_move_down',
                'params' => array(
                    'menuid' => $menuid,
                    'item' => $item->getId(),
                ),
            );
        };
        $configurator->addItemAction(new SimpleItemAction($itemRoute, 'arrow-down', 'kuma_admin_list.action.move_down'));

        return parent::doIndexAction($configurator, $request);
    }
1056743
private function createDeleteForm(MenuItem $menuItem)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('coreextra_menuitem_delete', array('id' => $menuItem->getId())))
            ->setMethod('DELETE')
            ->getForm()
        ;
    }
1362707
public function changeAction(Item $item, Request $request)
    {
        /* @var $form Form */
        $form = $this->createForm('entity_item', $item)
            ->handleRequest($request);
        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($item);
            $em->flush();

            return $this->redirect($this->generateUrl(
                'item_show',
                ['id' => $item->getId(), 'name' => $item->getUrlName()]
            ));
        }

        return $this->render('AnimeDbCatalogBundle:Item:change.html.twig', [
            'item' => $item,
            'form' => $form->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(),
            ));
        }
13985
def edit
      @menu = Menu.find(params[:id])

      # add breadcrumb and set title
      add_breadcrumb I18n.t("controllers.admin.menus.edit.breadcrumb", menu_name: @menu.name)
      set_title(I18n.t("controllers.admin.menus.edit.title", menu_name: @menu.name))
    end
1217553
public function updateMenuItemAction(Request $request, MenuItem $menuItem)
    {
        $em = $this->getDoctrine()->getManager();

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

        $editForm = $this->createMenuItemEditForm($menuItem);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $this->get('amulen.page.service.menu')->reorder($menuItem->getMenu());
            if($menuItem->getPage()){
                $menuItem->setPageSlug($menuItem->getPage());
            }
            $em->flush();

            return $this->redirect($this->generateUrl('admin_menu_items', array('id' => $menuItem->getMenu()->getId())));
        }

        return array(
            'entity' => $menuItem,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
915386
public function editGalleryItemAction(GalleryItem $entity, Product $product, Request $request)
    {
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find GalleryItem entity.');
        }

        $editForm = $this->createEditGalleryItemForm($entity, $product);
        $deleteForm = $this->createDeleteGalleryItemForm($entity->getId());

        return array(
            'entity' => $entity,
            'product' => $product,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }