Edit button.

@param string $type
@param int    $id
@param string $class

@return string
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 '';
    }
327217
public function getEditForm($id = null, $fields = null)
    {
        $form = parent::getEditForm($id, $fields);

        $gridFieldName = $this->sanitiseClassName($this->modelClass);
        /** @var GridField $gridField */
        $gridField = $form->Fields()->fieldByName($gridFieldName);

        // GridField configuration
        /** @var GridFieldConfig $config */
        $config = $gridField->getConfig();

        // remove edit icon
        $config->removeComponentsByType(GridFieldEditButton::class);

        return $form;
    }
965244
protected function editCurrentResponse(string $id, string $type, string $content, array $options = array()) {
        if(empty($this->responses[$id])) {
            $this->responses[$id] = array();
        }
        
        if(!empty($this->responses[$id])) {
            $msg = \array_shift($this->responses[$id]);
        } else {
            $msg = null;
        }
        
        return $this->editResponse($msg, $type, $content, $options);
    }
763597
public function get($class, array $id)
    {
        if (!$this->isEnabled()) {
            return false;
        }

        $key = self::key($class, $id);

        return isset($this->members[$key])
        ? $this->members[$key]
        : false;
    }
543268
public function edit($id)
    {
        $blockType = $this->blockTypes->findById($id);
        $fields = $this->blockTypes->getAvailableFields($blockType);

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

        app('soda.interface')->setHeading($blockType->name);
        app('soda.interface')->breadcrumbs()->addLink(route('soda.block-types.index'), ucwords(trans('soda::terminology.block_type_plural')));

        return soda_cms_view('data.block-types.view', compact('blockType', 'fields'));
    }
431966
public function render($type, $id, $level)
    {
        return $this->providers[$type]->getHtml($id, $level);
    }
480358
public function edit($id, Route $route)
    {
        return $this->processor->edit($this, $id, $route);
    }
1085481
public function view($id, $type) {
		$params = array(
			'id' => $id,
			'type' => $type
		);
		return $this->master->call('files/view', $params);
	}
1333779
public function getEditForm($id=null, $fields=null) {
        if(!$id) {
            $id=$this->currentPageID();
        }
        
        
        $record=$this->getRecord($id);
        if($record && !$record->canView()) {
            return Security::permissionFailure($this);
        }
        
        
        
        if($record) {
            $fields=$record->getCMSFields();
            $actions=new FieldList(
                                    FormAction::create('doSave', _t('CodeBank.SAVE', '_Save'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'),
                                    FormAction::create('doCancel', _t('CodeBank.CANCEL', '_Cancel'))
                                );
            
            
            if($record->canDelete()) {
                $actions->push(FormAction::create('doDelete', _t('CodeBank.DELETE', '_Delete'))->addExtraClass('ss-ui-action-destructive'));
            }
            
            
            // Use <button> to allow full jQuery UI styling
            $actionsFlattened=$actions->dataFields();
            if($actionsFlattened) {
                foreach($actionsFlattened as $action) {
                    if($action instanceof FormAction) {
                        $action->setUseButtonTag(true);
                    }
                }
            }
            
            
            if($record->hasMethod('getCMSValidator')) {
                $validator=$record->getCMSValidator();
            }else {
                $validator=new RequiredFields();
            }
            
            
            $fields->push(new HiddenField('ID', 'ID'));
            
            $form=CMSForm::create($this, 'EditForm', $fields, $actions, $validator)->setHTMLID('Form_EditForm');
            $form->loadDataFrom($record);
            $form->disableDefaultAction();
            $form->addExtraClass('cms-edit-form');
            $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
            $form->addExtraClass('center '.$this->BaseCSSClasses());
            $form->setResponseNegotiator($this->getResponseNegotiator());
            $form->setAttribute('data-pjax-fragment', 'CurrentForm');
            
            
            $this->extend('updateEditForm', $form);
            
            
            //Display message telling user to run dev/build because the version numbers are out of sync
            if(CB_VERSION!='@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version!=CB_VERSION.' '.CB_BUILD_DATE) {
                $form->insertBefore(new LiteralField('<p class="message error">'._t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink'=>'<a href="dev/build?flush=all">', 'endlink'=>'</a>')).'</p>'), 'LanguageID');
            }else if($this->hasOldTables()) {
                $form->insertBefore(new LiteralField('<p class="message warning">'._t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink'=>'<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink'=>'</a>')).'</p>'), 'LanguageID');
            }
            
            $form->Actions()->push(new LiteralField('CodeBankVersion', '<p class="codeBankVersion">Code Bank: '.$this->getVersion().'</p>'));
            
            
            Requirements::javascript(CB_DIR.'/javascript/CodeBank.EditForm.js');
            
            return $form;
        }
        
        $form=$this->EmptyForm();
        if(Session::get('CodeBank.deletedSnippetID')) {
            $form->Fields()->push(new HiddenField('ID', 'ID', Session::get('CodeBank.deletedSnippetID')));
        }
        
        
        //Display message telling user to run dev/build because the version numbers are out of sync
        if(CB_VERSION!='@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version!=CB_VERSION.' '.CB_BUILD_DATE) {
            $form->push(new LiteralField('<p class="message error">'._t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink'=>'<a href="dev/build?flush=all">', 'endlink'=>'</a>')).'</p>'));
        }else if($this->hasOldTables()) {
            $form->push(new LiteralField('<p class="message warning">'._t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink'=>'<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink'=>'</a>')).'</p>'));
        }
        
        $this->redirect('admin/codeBank/');
        return $form;
    }
1276105
public static function get_instance($id, $type) {

        switch ($type) {
            case 'site':
            case 'course':
            case 'module':
                return new blog_filter_context($id, $type);
                break;

            case 'group':
            case 'user':
                return new blog_filter_user($id, $type);
                break;

            case 'tag':
                return new blog_filter_tag($id);
                break;

            default:
                $classname = "blog_filter_$type";
                if (class_exists($classname)) {
                    return new $classname($id, $type);
                }
        }
    }
957347
protected function bootstrapClassResolution($type, $class)
    {
        $result = $type . ' ';

        $parts = explode(' ', $class);

        foreach( $parts as $part )
        {
            if( ! strstr($part, $type) )
            {
                $result .= Base::prefix($part, $type . '-');
            }
            else
            {
                $result .= $part;
            }

            $result .= ' ';
        }

        return trim($result);
    }
177186
function GetById($type, $id){
        $newClass = NAMESPACE_ENTITIES . $type;
        if(class_exists ($newClass)) {
            $class = new $newClass();
            $primaryKey = ModelState::GetPrimary($class);
            if ($primaryKey != null)
                return $this->Get($type, $primaryKey . '=' . $id)->FirstOrDefault();

            return null;
        }

        throw new OwlException("Classe {$newClass} não encontrada", 1);
    }
424760
public static function open($name = NULL,
                         $class = NULL,
                         $id = NULL,
                         $method = 'POST',
                         $action = '',
                         $attrs = array()
                         )
    {
        $tag = NULL;
        
        if($class)
            $attrs['class'] = $class;
        if($id)
            $attrs['id'] = $id;
        $attrs['method'] = $method;
        $attrs['action'] = $action;
        
        $tag .= '<form';
        $tag .= ' ' . self::parseAttrs($attrs);
        $tag .= '>';
        return $tag;
    }
708522
public function stepCreateRecord($type, $id) {
		$class = $this->convertTypeToClass($type);
		$fields = $this->prepareFixture($class, $id);
		$this->fixtureFactory->createObject($class, $id, $fields);
	}
239859
public function getEditForm($id = null, $fields = null)
    {
        $form = parent::getEditForm($id, $fields);
        $grid_field = $form
            ->Fields()
            ->fieldByName($this->sanitiseClassName($this->modelClass));

        // Add bulk editing to gridfield
        $manager = new BulkManager();
        $manager->removeBulkAction(UnlinkHandler::class);

        $config = $grid_field->getConfig();

        $config
            ->removeComponentsByType(GridFieldPaginator::class)
            ->addComponent($manager)
            ->addComponent(new GridFieldConfigurablePaginator());

        // Switch to custom filter header
        $config
            ->removeComponentsByType(SSGridFieldFilterHeader::class)
            ->addComponent(new GridFieldFilterHeader(
                false,
                function ($context) {
                    $this->extend('updateSearchContext', $context);
                },
                function ($form) {
                    $this->extend('updateSearchForm', $form);
                }
            ));

        if (!$this->showSearchForm ||
            (is_array($this->showSearchForm) && !in_array($this->modelClass, $this->showSearchForm))
        ) {
            $config->removeComponentsByType(GridFieldFilterHeader::class);
        }

        if ($this->config()->auto_convert_dates) {
            GridFieldDateFinder::create($grid_field)->convertDateFields();
        }

        return $form;
    }
626713
public function getEditForm($id=null, $fields=null) {
        $form=parent::getEditForm($id, $fields);
        
        Requirements::css(KAPOST_DIR.'/css/KapostAdmin.css');
        Requirements::javascript(KAPOST_DIR.'/javascript/KapostAdmin.js');
        
        
        if($this->modelClass=='KapostObject' && $gridField=$form->Fields()->dataFieldByName('KapostObject')) {
            $gridField->setList($gridField->getList()->filter('IsKapostPreview', 0));
            $gridField->getConfig()
                                ->addComponent(new KapostGridFieldRefreshButton('before'))
                                ->removeComponentsByType('GridFieldAddNewButton')
                                ->getComponentByType('GridFieldDataColumns')
                                    ->setFieldCasting(array(
                                                            'Created'=>'SS_Datetime->FormatFromSettings',
                                                            'KapostChangeType'=>'KapostFieldCaster->NiceChangeType',
                                                            'ToPublish'=>'KapostFieldCaster->NiceToPublish'
                                                        ));
            
            $gridField->getConfig()
                                ->getComponentByType('GridFieldDetailForm')
                                    ->setItemRequestClass('KapostGridFieldDetailForm_ItemRequest');
        }else if($this->modelClass=='KapostConversionHistory' && $gridField=$form->Fields()->dataFieldByName('KapostConversionHistory')) {
            $gridField->getConfig()
                                ->removeComponentsByType('GridFieldAddNewButton')
                                ->addComponent(new KapostDestinationAction(), 'GridFieldEditButton');
            
            
            $dataColumns=$gridField->getConfig()->getComponentByType('GridFieldDataColumns');
            $dataColumns->setFieldCasting(array(
                                                'Created'=>'SS_Datetime->FormatFromSettings'
                                            ));
            
            $columns=$dataColumns->getDisplayFields($gridField);
            $columns['DestinationTypeNice']=_t('KapostConversionHistory.db_DestinationType', '_Destination Type');
            $columns['KapostChangeTypeNice']=_t('KapostConversionHistory.db_KapostChangeType', '_Change Type');
            $columns=$dataColumns->setDisplayFields($columns);
            
            
            $gridField->getConfig()->getComponentByType('GridFieldDetailForm')->setItemEditFormCallback(function(Form $form) {
                                                                                                            $form->addExtraClass('KapostAdmin');
                                                                                                        });
        }
        
        
        $form->addExtraClass('KapostAdmin');
        
        return $form;
    }
1339082
protected function _edit($id) {
		try {
			$result = $this->{$this->modelClass}->edit($id, $this->request->data);
		} catch (OutOfBoundsException $e) {
			return $this->alert($e, array('redirect' => $this->referer(array('action' => 'list'), true)));
		}

		$this->request->data = $this->{$this->modelClass}->data;

		if (!empty($this->request->data[$this->{$this->modelClass}->alias][$this->{$this->modelClass}->displayField])) {
			$this->_appendToCrumb($this->request->data[$this->{$this->modelClass}->alias][$this->{$this->modelClass}->displayField]);
		}

		if (false === $result) {
			$this->alert('save.fail');
		} else if ($this->request->is('put')) {
			$this->alert('save.success');
		}
	}