Generate de edit view of a model
@param array $config Configuration array
@param integer $id Key of the object
@param boolean $simple Optional True for a simple view (just the form)
@param Model $registro Optional The object
@return HTML Edit form
438119
public static function edit($config, $id = null, $simple = false, $registro = null) {
        //$config = CrudGenerator::translateConfig($config);
        $modelo = strtolower(class_basename($config["modelo"]));
        $config = CrudGenerator::loadTodosFromConfig($config);

        if ($registro == null) {
            $modeloM = ucfirst($config['modelo']);
            if ($id == null) {
                $registro = $modeloM::first();
            } elseif (is_object($id)) {
                $registro = $id;
                $id = $registro->getKey();
            } else {
                $registro = $modeloM::find($id);
            }
        }
        if (!CrudGenerator::checkPermission($config, $registro->getKey())) {
            return View::make('sirgrimorum::crudgen.error', ['message' => trans('crudgenerator::admin.messages.permission')]);
        }
        if ($config['url'] == "Sirgrimorum_CrudAdministrator") {
            $config['url'] = route("sirgrimorum_modelo::update", ["modelo" => $modelo, "registro" => $registro->id]);
            if (\Lang::has('crudgenerator::' . $modelo . '.labels.edit')) {
                $config['botones'] = trans("crudgenerator::$modelo.labels.edit");
            } else {
                $config['botones'] = trans("crudgenerator::admin.layout.editar");
            }
        }
        if (!$simple) {
            $js_section = config("sirgrimorum.crudgenerator.js_section");
            $css_section = config("sirgrimorum.crudgenerator.css_section");
        } else {
            $js_section = "";
            $css_section = "";
        }
        $view = View::make('sirgrimorum::crudgen.edit', [
                    'config' => $config,
                    'registro' => $registro,
                    'tieneHtml' => CrudGenerator::hasTipo($config, ['html','article']),
                    'tieneDate' => CrudGenerator::hasTipo($config, ['date', 'datetime', 'time']),
                    'tieneSlider' => CrudGenerator::hasTipo($config, 'slider'),
                    'tieneSelect' => CrudGenerator::hasTipo($config, ['select', 'relationship', 'relationships']),
                    'tieneSearch' => CrudGenerator::hasTipo($config, [ 'relationshipssel']),
                    'tieneFile' => CrudGenerator::hasTipo($config, [ 'file', 'files']),
                    'tieneJson' => CrudGenerator::hasTipo($config, [ 'json']),
                    'js_section' => $js_section,
                    'css_section' => $css_section,
                    'modelo' => $modelo
        ]);
        return $view->render();
    }
680314
private function _createDispatchByConfig($id, $config)
    {
        if (!is_array($config)) {
            $config = ['class' => $config];
        }
        
        internal:
        $className = ltrim($config['class'], '\\');
        
        $dispatch = null;
        if (class_exists($className)) {
            if (is_subclass_of($className, 'wocenter\core\Dispatch')) {
                $dispatch = Yii::createObject($config, [
                    $id,
                    Yii::$app->controller ?: $this,
                ]);
                
                if (get_class($dispatch) !== $className) {
                    $dispatch = null;
                }
            } elseif (YII_DEBUG) {
                throw new InvalidConfigException("Dispatch class must extend from \\wocenter\\core\\Dispatch.");
            }
        } // 调度器不存在则调用系统扩展内调度器
        elseif ($this->_isDeveloperMode()) {
            $config['class'] = StringHelper::replace($config['class'], 'developer\\');
            if (class_exists($config['class'])) {
                goto internal;
            }
        }
        
        if ($dispatch === null) {
            $this->_generateDispatchFile($className);
        }
        
        Yii::trace('Loading dispatch: ' . $className, __METHOD__);
        
        return $dispatch;
    }
619631
public function ajaxForm(ModelInterface $model, $action, $config = null)
    {
        $view = isset($config['view']) ? $config['view'] : '//widgets/ajax_form';
        if (!isset($config['id'])) {
            $config['id'] = static::getUniqueID();
        }
        $formView = null;

        if ($model->accessControl($action)) {

            if (isset($_POST[$model->getID()])) {
                $model->attributes = $_POST[$model->getID()];
                if ($model->validate()) {
                    $model->save();
                }
            }

            $formView = new FormWidget($model, $config);



            } else {
            $view = '//widgets/access_denied';
        }

        $content = $this->render($view, [
            'block_id' => $config['id'],
            'widget_id' => 'ajaxForm',
            'dataAction' => $action,
            'form' => $formView,
            'model_block_full_id' => str_replace('\\', '__', get_class($model)),
            'widget_start_params' => json_encode($config),
            'renderMode' => $this->getRenderMode(),
        ]);

    }
787219
public function plainText(MailConfig $config, array $data)
    {
        $plainTemplate = $config->template().$this->plainSuffix;

        if ($this->views->exists($plainTemplate)) {
            return $this->views->make($plainTemplate, $data)->render();
        }

        if (!$this->htmlPlainConverter) {
            return '';
        }

        return call_user_func($this->htmlPlainConverter, $this->html($config, $data),  $data);
    }
632961
public function renderViewGeneric( $template, $models, $viewFile, $config = [] ) {

		$config[ 'viewFile' ]	= isset( $config[ 'viewFile' ] ) ? $config[ 'viewFile' ] : $viewFile;
		$config[ 'page' ]		= isset( $config[ 'page' ] ) ? $config[ 'page' ] : true;

		return $this->renderView( $template, $models, $config );
	}
1307474
public function makeRadio($config, $selected, $custom)
    {
        return '<input '.$this->processCustom($custom).' id="'.$this->getId($config).'" '.$selected.' type="radio" name="'.$config['name'].'" class="'. $config['class'] .'">';
    }
1152966
public static function getCodeImage($id, $config = array())
    {
        $key = self::getKey($id);
        
        return captcha($key, $config);
    }
558609
public function renderWidget( $config = [] ) {

		if( !isset( $this->title ) ) {

			switch( $this->template ) {

				case 'message': {

					$this->title = 'Message';

					break;
				}
				case 'success': {

					$this->title = 'Success';

					break;
				}
				case 'warning': {

					$this->title = 'Alert';

					break;
				}
				case 'error': {

					$this->title = 'Error';

					break;
				}
			}
		}

		if( !isset( $this->size ) ) {

			if( $this->modal && in_array( $this->template, [ 'message', 'success', 'warning', 'error' ] ) ) {

				$this->size = 'medium';
			}
		}

		$widgetHtml = $this->render( $this->template, [
			'widget' => $this
		]);

		return $widgetHtml;
	}
776404
public static function create($id, array $config)
    {
        static::$databaseConnections[$id] = static::createDatabaseConnection($config);

        if (static::$activeDatabaseConnection === null) {
            static::select($id);
        }
    }
623270
public function registerConfig(ConfigInterface $config, $id)
    {
        $this->configurationDefinitions[spl_object_hash($config)] = $config;
        $this->configurationIds[spl_object_hash($config)] = $id;
        $this->configTree->set($config->getPath(), $config);
        $config->setConfigManager($this);
    }
471056
public function getEditForm($id = null, $fields = null)
    {
        /** @var CMSForm $form */
        $form = parent::getEditForm($id, $fields);
        $gridField = $form->Fields()->fieldByName($this->sanitiseClassName($this->modelClass));
        return $this->modifyGridField($form, $gridField);
    }
1004230
public function renderWidget( $config = [] ) {

		if( !isset( $this->slug ) ) {

            throw new InvalidConfigException( "The slider slug option is required." );
        }

		$this->model = $this->modelService->getBySlug( $this->slug );

		$model	= $this->model;
		$items 	= [];

		if( !isset( $model ) ) {

			return "<div>Slider having slug set to $this->slug does not exist. Please create it via admin.</div>";
        }

		// Configure
		$this->configureSlider();

		// Views Path
		$slidePath = "$this->template/slide";

		// Generate Slides Html

		$slides = $model->slides;

        foreach( $slides as $slide ) {

            $items[] = $this->render( $slidePath, [
				'widget' => $this, 'fxOptions' => $this->fxOptions, 'slide' => $slide,
				'genericContent' => $this->genericContent
			]);
        }

		// Register JS
		$modelOptions	= json_encode( $this->fxOptions );
		$modelJs		= "jQuery( '.fx-" . $model->slug . "' ).foxslider( $modelOptions );";

		$this->getView()->registerJs( $modelJs, View::POS_READY );

		$htmlContent = implode( "\n", $items );

		if( $this->wrap ) {

			// Apply model options - Overrides widget and template options
			$htmlOptions = json_decode( $model->htmlOptions, true );

			$options = !empty( $htmlOptions ) ? ArrayHelper::merge( $this->options, $htmlOptions ) : $this->options;

			//$options[ 'id' ] = "fxs-{$model->slug}";

			$classOption = isset( $options[ 'class' ] ) ? $options[ 'class' ] : null;
			$classOption = !empty( $classOption ) ? "fx $classOption fx-{$model->slug}" : "fx fx-{$model->slug}";

			$options[ 'class' ] = $classOption;

			return Html::tag( 'div', $htmlContent, $options );
		}

		return $htmlContent;
    }
436106
public static function create($config, $simple = false) {
        //$config = CrudGenerator::translateConfig($config);
        if (request()->has('_itemRelSel')) {
            list($itemsRelSelCampo, $itemsRelSelId) = explode("|", request()->_itemRelSel);
            foreach ($config['campos'] as $clave => $relacion) {
                if ($clave != $itemsRelSelCampo) {
                    unset($config['campos'][$clave]);
                }
            }
        }
        if (!CrudGenerator::checkPermission($config)) {
            return View::make('sirgrimorum::crudgen.error', ['message' => trans('crudgenerator::admin.messages.permission')]);
        }
        $modelo = strtolower(class_basename($config["modelo"]));
        $config = CrudGenerator::loadTodosFromConfig($config);

        if (!$simple) {
            $js_section = config("sirgrimorum.crudgenerator.js_section");
            $css_section = config("sirgrimorum.crudgenerator.css_section");
        } else {
            $js_section = "";
            $css_section = "";
        }
        if ($config['url'] == "Sirgrimorum_CrudAdministrator") {
            $config['url'] = route("sirgrimorum_modelo::store", ["modelo" => $modelo]);
            if (\Lang::has('crudgenerator::' . $modelo . '.labels.create')) {
                $config['botones'] = trans("crudgenerator::$modelo.labels.create");
            } else {
                $config['botones'] = trans("crudgenerator::admin.layout.crear");
            }
        }
        if (request()->has('_itemRelSel')) {
            $view = View::make('sirgrimorum::crudgen.templates.relationshipssel_simple', [
                        'config' => $config,
                        'datoId' => $itemsRelSelId,
                        'columna' => $itemsRelSelCampo,
                        'tabla' => (new $config['campos'][$itemsRelSelCampo]['modelo'])->getTable(),
                        'datos' => $config['campos'][$itemsRelSelCampo],
                        'js_section' => $js_section,
                        'css_section' => $css_section,
                        'modelo' => $modelo
            ]);
        } else {
            $view = View::make('sirgrimorum::crudgen.create', [
                        'config' => $config,
                        'tieneHtml' => CrudGenerator::hasTipo($config, ['html','article']),
                        'tieneDate' => CrudGenerator::hasTipo($config, ['date', 'datetime', 'time']),
                        'tieneSlider' => CrudGenerator::hasTipo($config, 'slider'),
                        'tieneSelect' => CrudGenerator::hasTipo($config, ['select', 'relationship', 'relationships']),
                        'tieneSearch' => CrudGenerator::hasTipo($config, [ 'relationshipssel']),
                        'tieneFile' => CrudGenerator::hasTipo($config, [ 'file', 'files']),
                        'tieneJson' => CrudGenerator::hasTipo($config, [ 'json']),
                        'js_section' => $js_section,
                        'css_section' => $css_section,
                        'modelo' => $modelo
            ]);
        }
        return $view->render();
    }
80665
public function search($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'search'          => null,
            'submit_on_clear' => true,
            'placeholder'     => $this->getObject('translator')->translate('Find by title or description&hellip;')
        ));

        $html = '';

        if ($config->submit_on_clear)
        {
            $html .= $this->createHelper('behavior')->jquery();
            $html .= '
            <script>
            (function() {
            var value = '.json_encode($config->search).',
                submitForm = function(form) {
                    if (form.length) {
                        var controller = form.data("controller");
                        if (typeof controller === "object" && controller !== null
                                && controller.grid && typeof controller.grid.uncheckAll !== "undefined") {
                            controller.grid.uncheckAll();
                        }

                        form[0].submit();
                    }
                },
                send = function(event) {
                    var v = kQuery(this).val();

                    if (v) {
                        kQuery(".k-search__empty").addClass("k-is-visible");
                    } else {
                        kQuery(".k-search__empty").removeClass("k-is-visible");
                    }

                    if (event.which === 13 || (event.type === "blur" && (v || value) && v != value)) {
                        event.preventDefault();
                        submitForm(kQuery(this).parents("form"));
                    }
                };

            kQuery(function($) {
                $(".k-search__field").keypress(send).blur(send);
                var empty_button = $(".k-search__empty");
                
                if (value) {
                    empty_button.addClass("k-is-visible");
                }
                
                empty_button.click(function(event) {
                    event.preventDefault();

                    var input = $(this).siblings("input");
                    input.val("");

                    if (value) {
                        submitForm(input.parents("form"));
                    }
                });
            });
            })();
            </script>';
        }

        $html .= '<div class="k-search k-search--has-both-buttons">';
        $html .= '<label for="k-search-input">' . $this->getObject('translator')->translate('Search') . '</label>';
        $html .= '<input id="k-search-input" type="search" name="search" class="k-search__field" placeholder="'.$config->placeholder.'" value="'.StringEscaper::attr($config->search).'" />';
        $html .= '<button type="submit" class="k-search__submit">';
        $html .= '<span class="k-icon-magnifying-glass" aria-hidden="true"></span>';
        $html .= '<span class="k-visually-hidden">' . $this->getObject('translator')->translate('Search') . '</span>';
        $html .= '</button>';
        $html .= '<button type="button" class="k-search__empty">';
        $html .= '<span class="k-search__empty-area">';
        $html .= '<span class="k-icon-x" aria-hidden="true"></span>';
        $html .= '<span class="k-visually-hidden">' . $this->getObject('translator')->translate('Clear search') . '</span>';
        $html .= '</span>';
        $html .= '</button>';

        if ($config->search) {
            $html .= '<div class="k-scopebar__item-label k-scopebar__item-label--numberless"></div>';
        }

        $html .= '</div>';



        return $html;
    }
225439
public function getEdit($id = '')
    {

        $form = FormBuilder::create(get_class($this->form));


        $form_content = view('form-builder::form.components.formgenerator.full', [
            'form' => $form
        ]);
        $content      = view('expendable::admin.form.state.form', [

        ]);

        $this->layoutManager->add([
            'form'    => $form_content,
            'content' => $content,
        ]);

        return $this->layoutManager->render();
    }
95967
public function edit($id) {
		$dep        = Dep::find($id);
		$department = Dep::where('parent', null)->pluck('name_'.app('l'), 'id');
		return view('admin.department.edit', ['title' => trans('admin.edit'),
				'department'                                => $department,
				'edit'                                      => $dep,
			]);
	}
923515
public function getEditForm($id=null, $fields=null) {
        if(!$id) {
            $id=$this->currentPageID();
        }
        
        
        $form=parent::getEditForm($id);
        
        
        $record=$this->getRecord($id);
        if($record && !$record->canView()) {
            return Security::permissionFailure($this);
        }
        
        
        if(!$fields) {
            $fields=$form->Fields();
        }
        
        
        $actions=$form->Actions();
        
        
        if($record) {
            $fields->push($idField=new HiddenField("ID", false, $id));
            $versions=$record->Versions()->filter('ID:not', $record->CurrentVersionID)->Map('ID', 'Created');
            $actions=new FieldList(
                                    new FormAction('doCopy', _t('CodeBank.COPY', '_Copy')),
                                    new FormAction('doEditRedirect', _t('CodeBank.EDIT', '_Edit')),
                                    new FormAction('doExport', _t('CodeBank.EXPORT', '_Export')),
                                    new FormAction('doPrint', _t('CodeBank.PRINT', '_Print')),
                                    new LabelField('Revision', _t('CodeBank.REVISION', '_Revision').': '),
                                    DropdownField::create('RevisionID', '', $versions, $this->urlParams['OtherID'])
                                                                                                                ->setEmptyString('{'._t('CodeBank.CURRENT_REVISION', '_Current Revision').'}')
                                                                                                                ->setDisabled($record->Versions()->Count()<=1)
                                                                                                                ->addExtraClass('no-change-track'),
                                    FormAction::create('compareRevision', _t('CodeBank.COMPARE_WITH_CURRENT', '_Compare with Current'))->setDisabled($record->Versions()->Count()<=1 || empty($this->urlParams['OtherID']) || !is_numeric($this->urlParams['OtherID']))
                                );
            
            
            // 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();
            }
            
            
            if($record->Package() && $record->Package()!==false && $record->Package()->ID!=0) {
                $package=new ArrayList(array($record->Package()));
            }else {
                $package=null;
            }
            
            $fields->insertBefore($fields->dataFieldByName('Title'), 'LanguageID');
            $fields->replaceField('PackageID', new PackageViewField('PackageID', _t('Snippet.PACKAGE', '_Package'), $package, $record->ID));
            $fields->replaceField('Text', HighlightedContentField::create('SnippetText', _t('Snippet.CODE', '_Code'), $record->Language()->HighlightCode)->setForm($form));
            $fields->replaceField('Tags', new TagsViewField('Tags', _t('Snippet.TAGS_COLUMN', '_Tags')));
            $fields->addFieldToTab('Root.Main', $creator=ReadonlyField::create('CreatorName', _t('CodeBank.CREATOR', '_Creator'), ($record->Creator() && $record->Creator()->ID>0 ? '<a href="'.$this->Link().'?creator='.$record->CreatorID.'">'.$record->Creator()->Name.'</a>':_t('CodeBank.UNKNOWN_USER', '_Unknown User')))->setForm($form));
            $creator->dontEscape=true;
            $fields->addFieldToTab('Root.Main', ReadonlyField::create('LanguageName', _t('CodeBank.LANGUAGE', '_Language'), $record->Language()->Name)->setForm($form));
            $fields->addFieldToTab('Root.Main', DatetimeField_Readonly::create('LastModified', _t('CodeBank.LAST_MODIFIED', '_Last Modified'), $record->CurrentVersion->LastEdited)->setForm($form));
            $fields->addFieldToTab('Root.Main', ReadonlyField::create('LastEditorName', _t('CodeBank.LAST_EDITED_BY', '_Last Edited By'), ($record->LastEditor() && $record->LastEditor()->ID>0 ? $record->LastEditor()->Name:_t('CodeBank.UNKNOWN_USER', '_Unknown User')))->setForm($form));
            $fields->addFieldToTab('Root.Main', ReadonlyField::create('SnippetID', _t('CodeBank.ID', '_ID'), $record->ID));
            $fields->addFieldToTab('Root.Main', ReadonlyField::create('CurrentVersionID', _t('CodeBank.VERSION', '_Version')));
            $fields->push(new HiddenField('ID', 'ID'));
            
            $form=new Form($this, 'EditForm', $fields, $actions, $validator);
            $form->loadDataFrom($record);
            $form->disableDefaultAction();
            $form->addExtraClass('cms-edit-form');
            $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
            $form->addExtraClass('center '.$this->BaseCSSClasses());
            $form->setAttribute('data-pjax-fragment', 'CurrentForm');
            
            
            //Swap content for version text
            if(!empty($this->urlParams['OtherID']) && is_numeric($this->urlParams['OtherID'])) {
                $version=$record->Version(intval($this->urlParams['OtherID']));
                if(!empty($version) && $version!==false && $version->ID!=0) {
                    $fields->dataFieldByName('SnippetText')->setValue($version->Text);
                    $fields->dataFieldByName('LastModified')->setValue($version->LastEdited);
                    $fields->dataFieldByName('CurrentVersionID')->setValue($version->ID);
                }
                
                $form->Fields()->insertBefore(new LiteralField('NotCurrentVersion', '<p class="message warning">'._t('CodeBank.NOT_CURRENT_VERSION', '_You are viewing a past version of this snippet\'s content, {linkopen}click here{linkclose} to view the current version', array('linkopen'=>'<a href="admin/codeBank/show/'.$record->ID.'">', 'linkclose'=>'</a>')).'</p>'), 'Title');
            }
            
            
            $readonlyFields=$form->Fields()->makeReadonly();
            
            $form->setFields($readonlyFields);
            
            
            $this->extend('updateEditForm', $form);
            
            $form->Actions()->push(new LiteralField('CodeBankVersion', '<p class="codeBankVersion">Code Bank: '.$this->getVersion().'</p>'));
            
            
            Requirements::add_i18n_javascript(CB_DIR.'/javascript/lang');
            Requirements::add_i18n_javascript('mysite/javascript/lang');
            Requirements::javascript(CB_DIR.'/javascript/external/jquery-zclip/jquery.zclip.min.js');
            Requirements::javascript(CB_DIR.'/javascript/CodeBank.ViewForm.js');
            
            
            //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->Fields()->insertBefore(new LiteralField('DBUpgrade', '<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>'), 'Title');
            }else if($this->hasOldTables()) {
                $form->Fields()->insertBefore(new LiteralField('DBUpgrade', '<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>'), 'Title');
            }
            
            return $form;
        }else if($id) {
            $form=CMSForm::create($this, 'EditForm', new FieldList(
                                                            new TabSet('Root',
                                                                            new Tab('Main', ' ',
                                                                                        new LabelField('DoesntExistLabel', _t('CodeBank.SNIPPIT_NOT_EXIST', '_Snippit does not exist'))
                                                                                    )
                                                                    )
                                                        ), new FieldList())->setHTMLID('Form_EditForm');
            $form->addExtraClass('cms-edit-form');
            $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
            $form->addExtraClass('center '.$this->BaseCSSClasses());
            $form->setAttribute('data-pjax-fragment', 'CurrentForm');
            
            
            //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->Fields()->insertBefore(new LiteralField('DBUpgrade', '<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>'), 'DoesntExist');
            }else if($this->hasOldTables()) {
                $form->Fields()->insertBefore(new LiteralField('DBUpgrade', '<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>'), 'DoesntExistLabel');
            }
        }else {
            $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->Fields()->push(new LiteralField('DBUpgrade', '<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->Fields()->push(new LiteralField('DBUpgrade', '<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>'));
            }
        }
        
        
        $form->disableDefaultAction();
        $form->addExtraClass('cms-edit-form');
        $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
        $form->addExtraClass('center '.$this->BaseCSSClasses());
        
        $form->Actions()->push(new LiteralField('CodeBankVersion', '<p class="codeBankVersion">Code Bank: '.$this->getVersion().'</p>'));
        
        return $form;
    }