Get a contao backend modal edit link.

@param string      $module Name of the module
@param int         $id     Id of the entity
@param string|null $label  The label text

@return string The edit link
543974
public function getEditLink(string $module, int $id, string $label = null): string
    {
        $url = $this->container->get('huh.utils.url')->getCurrentUrl([
            'skipParams' => true,
        ]);

        if (!$id) {
            return '';
        }

        $label = sprintf(StringUtil::specialchars($label ?: $GLOBALS['TL_LANG']['tl_content']['editalias'][1]), $id);

        return sprintf(
            ' <a href="'.$url.'?do=%s&amp;act=edit&amp;id=%s&amp;rt=%s" title="%s" style="padding-left: 5px; padding-top: 2px; display: inline-block;">%s</a>',
            $module,
            $id,
            $this->container->get('security.csrf.token_manager')->getToken($this->container->getParameter('contao.csrf_token_name'))->getValue(),
            $label,
            Image::getHtml('alias.svg', $label, 'style="vertical-align:top"')
        );
    }
1084714
public static function url($id, $module_id = '') {
        $absolute_urls = false;
        if($module_id == '') {
            $module = \jacmoe\mdpages\Module::getInstance();
            if(!is_null($module)) {
                $module_id = $module->id;
                $absolute_urls = $module->absolute_wikilinks;
            }
        }
        if($module_id != '') {
            return Url::to(array('/' . $module_id . '/page/view', 'id' => $id), $absolute_urls);
        }
    }
53664
public function getModalDelete($id = null)
    {
        $confirm_route = $error = null;

        $title = 'Delete group';
        $message = 'Are you sure to delete this group?';

        // Get group information
        $group = Sentinel::getRoleRepository()->findOrFail($id);

        if ($group == null)
        {
            // Prepare the error message
            $error = Lang::get('base.groups.not_found');
            return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route'));
        }

        $confirm_route = route('delete/group', ['id' => $group->id]);
        return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route'));
    }
1332703
public function edit($id = null) {
        $this->loadModel('CmsContent');
        $cmsContent = $this->CmsContent->get($id, [
            'contain' => []
        ]);

        /**
         * 
         */
        if ($cmsContent->content_type != 'news') :
            $this->Flash->error('The cms content is not NEWS object');
            return $this->redirect(['action' => 'index']);
        endif;

        /**
         * 
         */
        if ($this->request->is(['patch', 'post', 'put'])) {

            /**
             * Before save the Content
             */
            $cmsContent->parent = 0;
            $cmsContent->name = parent::_permittedContentName($id, trim($this->request->data['name']));
            $cmsContent->content_title = $this->request->data['content_title'];
            $cmsContent->content_description = $this->request->data['content_description'];
            $cmsContent->content_excerpt = '';
            $cmsContent->content_deadline = $this->request->data['content_deadline'];
            $cmsContent->password = $this->request->data['content_password'];
            $cmsContent->content_status = $this->request->data['content_status'];
            $cmsContent->publish_start = $this->request->data['publish_start'];
            $cmsContent->publish_end = $this->request->data['publish_end'];
            $cmsContent->author = '';
            $cmsContent->modified = date('Y-m-d H:i:s');
            
            /**
             * Default button_publish_action
             */
            if (isset($this->request->data['button_publish_action']))
                $cmsContent->content_status = 'publish';


            if ($this->CmsContent->save($cmsContent)) {

                /**
                 * Save all related elements
                 */
                if (isset($this->request->data['related']['page']) && count($this->request->data['related']['page']))
                    parent::saveRelatedPage($id, $this->request->data['related']['page']);
                if (isset($this->request->data['related']['attached']) && count($this->request->data['related']['attached']))
                    parent::saveRelatedAttached($id, $this->request->data['related']['attached']);
                if (isset($this->request->data['related']['image']) && count($this->request->data['related']['image']))
                    parent::saveRelatedImage($id, $this->request->data['related']['image']);
                if (isset($this->request->data['related']['meta']) && count($this->request->data['related']['meta']))
                    parent::saveRelatedMeta($id, $this->request->data['related']['meta']);

                /**
                 * Delete related contents
                 */
                if (isset($this->request->data['delete_ck']['content_id']))
                    foreach ($this->request->data['delete_ck']['content_id'] as $key => $val) :
                        parent::deleteRelatedContent($key);
                    endforeach;

                /**
                 * Delete related meta
                 */
                if (isset($this->request->data['delete_ck']['meta_id']))
                    foreach ($this->request->data['delete_ck']['meta_id'] as $key => $val) :
                        parent::deleteRelatedMeta($key);
                    endforeach;

                /**
                 * Set FLASH and redirect
                 */
                $this->Flash->success('The cms content has been saved.');
                if (isset($this->request->data['button_save_action']))
                    return $this->redirect(['action' => 'edit', $id]);
                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error('The cms content could not be saved. Please, try again.');
            }
        }

        /**
         * Set parent_news_list
         */
        $cmsContent['parent_news_list'] = $this->_getParentNewsList($id);

        /**
         * Set content_status_list
         */
        $cmsContent['content_status_list'] = ['draft' => 'Draft', 'publish' => 'Publish'];

        /**
         * Set list of taxonomy
         */
        $where = ['taxonomy' => 'news'];
        $cmsContent['list_of_taxonomy'] = parent::getListOfTaxonomy($where);

        /**
         * Set list of taxonomy checked
         */
        $relationTable = TableRegistry::get('CmsTermRelation');
        $query = $relationTable->find()
                ->select(['cms_term_taxonomy_id'])
                ->where(['cms_content_id' => $id]);
        $cmsContent['list_of_taxonomy_checked'] = $query->all();

        /**
         * Set list of user
         */
        $cmsContent['list_of_user'] = parent::getListOfUser();

        /**
         * Set list of user checked
         */
        $cmsPermissionTable = TableRegistry::get('CmsPermission');
        $query = $cmsPermissionTable->find()
                ->select(['sys_user_id'])
                ->where(['cms_content_id' => $id]);
        $cmsContent['list_of_user_checked'] = $query->all();

        /**
         * Set list of role
         */
        $cmsContent['list_of_role'] = parent::getListOfRole();

        /**
         * Set list of role checked
         */
        $cmsPermissionTable = TableRegistry::get('CmsPermission');
        $query = $cmsPermissionTable->find()
                ->select(['sys_role_id'])
                ->where(['cms_content_id' => $id]);
        $cmsContent['list_of_role_checked'] = $query->all();

        /**
         * Create related array
         */
        $cmsContent['related'] = array();

        /**
         * Set related news
         */
        $where = ['parent' => $id, 'content_type' => 'news'];
        $cmsContent['related']['news'] = parent::getListOfContent($where);

        /**
         * Set related image
         */
        $where = ['parent' => $id, 'content_type' => 'image'];
        $cmsContent['related']['image'] = parent::getListOfContent($where);

        /**
         * Set related attached
         */
        $where = ['parent' => $id, 'content_type' => 'attached'];
        $cmsContent['related']['attached'] = parent::getListOfContent($where);

        /**
         * Set related meta
         */
        $where = ['cms_content_id' => $id];
        $cmsContent['related']['meta'] = parent::getListOfMeta($where);

        /**
         * 
         */
        $this->set('data', $cmsContent);
        $this->set('_serialize', ['data']);
    }
688612
public function editAction(Request $request, $id = null)
    {
        $this->denyAccessUnlessGranted('ROLE_ADMIN');

        $em = $this->getDoctrine()->getManager();

        if (is_numeric($id)) {
            $locale = $em->getRepository(Locale::class)->find($id);
        } else {
            $locale = $em->getRepository(Locale::class)->findOneByLocale($id);
        }

        $form = $this->createForm(new LocaleType(), $locale);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em->persist($locale);
            $em->flush();

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

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

        return $this->render('OpiferCmsBundle:Backend/Locale:edit.html.twig', [
            'locale' => $locale,
            'form' => $form->createView()
        ]);
    }
250731
public function getmodule($id){
		if(!$db=BFactory::getDBO()){
			return false;
			}
		$qr='SELECT * from `soft_modules_rules` where id='.$id;
		$q=$db->Query($qr);
		if(empty($q)){
			return $modules;
			}
		while($l=$db->fetch($q)){
			$id=(int)$l['id'];
			$module=new BSoftModule();
			$module->load($l);
			}
		return $module;
		}
500610
public function modalInfoAction($id)
        {

            /** @var Customer $oCustomer */
            $oCustomer = CustomerQuery::create()->findOneById($id);

            return $this->render('SlashworksAppBundle:Customer:modal_info.html.twig', array(
                'customer' => $oCustomer
            ));

        }
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))
        ));
    }
198727
public function edit($id)
    {
        $contentType = $this->contentTypes->findById($id);
        $contentTypes = $this->contentTypes->getList($id);
        $blockTypes = $this->contentTypes->getAvailableBlockTypes($contentType);
        $fields = $this->contentTypes->getAvailableFields($contentType);

        if (! $contentType) {
            return $this->handleError(trans('soda::errors.not-found', ['object' => trans('soda::terminology.content_type')]));
        }

        app('soda.interface')->breadcrumbs()->addLink(route('soda.content-types.index'), ucwords(trans('soda::terminology.content_type_plural')));
        app('soda.interface')->setHeading($contentType->name);

        return soda_cms_view('data.content.types.view', compact('contentType', 'contentTypes', 'blockTypes', 'fields'));
    }
980623
public static function get_module($id, $sectionreturn = null) {
        global $PAGE;
        // Validate and normalize parameters.
        $params = self::validate_parameters(self::get_module_parameters(),
            array('id' => $id, 'sectionreturn' => $sectionreturn));
        $id = $params['id'];
        $sectionreturn = $params['sectionreturn'];

        // Set of permissions an editing user may have.
        $contextarray = [
            'moodle/course:update',
            'moodle/course:manageactivities',
            'moodle/course:activityvisibility',
            'moodle/course:sectionvisibility',
            'moodle/course:movesections',
            'moodle/course:setcurrentsection',
        ];
        $PAGE->set_other_editing_capability($contextarray);

        // Validate access to the course (note, this is html for the course view page, we don't validate access to the module).
        list($course, $cm) = get_course_and_cm_from_cmid($id);
        self::validate_context(context_course::instance($course->id));

        $courserenderer = $PAGE->get_renderer('core', 'course');
        $completioninfo = new completion_info($course);
        return $courserenderer->course_section_cm_list_item($course, $completioninfo, $cm, $sectionreturn);
    }
77863
protected function saveLabel( $id, $label )
    {
        $locale = $this->getLocale();
        $sql    = $this->sql( $this->getTableInSchema(
            static::$labelTableName
        ) );

        $update = $sql->update()
                      ->set( array(
                          'label'   => $label,
                      ) )
                      ->where( array(
                          'menuId'  => $id,
                          'locale'  => $locale,
                      ) );

        $affected = $sql->prepareStatementForSqlObject( $update )
                        ->execute()
                        ->getAffectedRows();

        if ( $affected < 1 )
        {
            $insert = $sql->insert()
                          ->values( array(
                              'menuId'  => $id,
                              'locale'  => $locale,
                              'label'   => $label,
                          ) );

            $affected = $sql->prepareStatementForSqlObject( $insert )
                            ->execute()
                            ->getAffectedRows();
        }

        return $affected;
    }
4970
public function editBtn($type = null, $id = null, $class="btn-outline-secondary")
    {
        if (Gate::allows('cms', Auth::user())) {
            if (!is_null($id)) {
                return '<a href="'.url($this->backendRoute.'/'.$type.'/'.$id.'/edit').'" class="btn btn-sm '.$class.'"><span class="fa fa-edit"></span> Edit</a>';
            } else {
                return '<a href="'.url($this->backendRoute.'/'.$type).'" class="btn btn-sm '.$class.'"><span class="fa fa-edit"></span> Edit</a>';
            }
        }

        return '';
    }
92135
public function edit($id = null)
    {
        $position = $this->BannersPositions->get($id);

        if ($this->request->is(['patch', 'post', 'put'])) {
            $position = $this->BannersPositions->patchEntity($position, $this->request->getData());

            if ($this->BannersPositions->save($position)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('position'));
    }
815957
public function editTypeAction(Request $request, $id)
    {
        /** @var ContentManager $manager */
        $manager = $this->get('opifer.content.content_manager');

        /** @var Content $content */
        $content = $manager->getRepository()->find($id);

        $form = $this->createFormBuilder($content)
            ->add('contentType', EntityType::class, [
                'class' => $this->get('opifer.content.content_type_manager')->getClass(),
                'choice_label' => 'name',
            ])
            ->getForm();

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            /** @var EavManager $eavManager */
            $eavManager = $this->get('opifer.eav.eav_manager');
            $valueSet = $eavManager->createValueSet();

            $this->getDoctrine()->getManager()->persist($valueSet);

            $valueSet->setSchema($content->getContentType()->getSchema());
            $content->setValueSet($valueSet);

            $manager->save($content);

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

        return $this->render($this->getParameter('opifer_content.content_edit_type'), [
            'content' => $content,
            'form' => $form->createView(),
        ]);
    }
653821
public function addButtonEdit($link = '#', $binds = [], $is_remote = true, $method = 'post')
    {


        $c = new Column\Button(configurator()->get('button.edit.name'), configurator()->get('button.edit.label'), $link, $binds);
        $c->setOptionAsPrimary();
        $c->icon(configurator()->get('button.edit.icon'));
        if ($is_remote) {
            $c->enableRemote($method);
        }

        $this->addColumn($c);
        return $c;
    }
1367280
public function getAdminModalDelete($id = null)
    {
        $confirm_route = $error = null;

        $title = 'Delete User';
        $message = 'Are you sure to delete this user?';

        // Get user information
        $user = Sentinel::findById($id);

        if ($user == null)
        {
            // Prepare the error message
            $error = Lang::get('base.auth.not_found');
            return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route'));
        }

        // Check if we are not trying to delete ourselves
        if ($user->id === Sentinel::getUser()->id)  {
            // Prepare the error message
            $error = Lang::get('base.base.error');

            return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route'));
        }

        $confirm_route = route('delete/user', ['id' => $user->id]);
        return View('layouts.modal_confirmation', compact('title', 'message', 'error', 'model', 'confirm_route'));
    }
215019
public static function label($label, $id = null, array $attributes = array())
	{
		return static::$instance->label($label, $id, $attributes);
	}