FormController ------------------------
968709
public function actionAll() {

		$modelClass	= $this->modelService->getModelClass();

		$dataProvider = $this->modelService->getPageByType( $this->type );

		return $this->render( 'all', [
			'dataProvider' => $dataProvider,
			'submits' => $this->submits,
			'visibilityMap' => $modelClass::$visibilityMap,
			'statusMap' => $modelClass::$statusMap
		]);
	}
1265127
public function addCurrentController(): void
    {
        $controllerName = Inflector::camelize($this->_frontendData['request']['controller']);
        $this->addController(
            $controllerName . '.' . Inflector::camelize($this->_frontendData['request']['action'])
        );
        $this->addController($controllerName);
    }
726599
protected function loadFormData()
    {
        if (! $this->formData) {
            parent::loadFormData();

            $model     = $this->getModel();
            $roles     = $model->get('ggp_role', 'multiOptions');
            $userRoles = $this->currentUser->getAllowedRoles();

            // \MUtil_Echo::track($userRoles, $roles);
            // Make sure we get the roles as they are labeled
            foreach ($roles as $role => $label) {
                if (! isset($userRoles[$role])) {
                    unset($roles[$role]);
                }
            }

            if ($this->formData['ggp_role'] && (! isset($roles[$this->formData['ggp_role']]))) {
                if ($this->createData) {
                    $this->formData['ggp_role'] = reset($roles);
                } else {
                    $this->addMessage($this->_('You do not have sufficient privilege to edit this group.'));
                    $this->afterSaveRouteUrl = array($this->request->getActionKey() => 'show');
                    $this->resetRoute        = false;
                    return;
                }
            }
            $model->set('ggp_role', 'multiOptions', $roles);

            $this->menu->getParameterSource()->offsetSet('ggp_role', $this->formData['ggp_role']);
        }
    }
1304868
protected function createController()
    {
        Artisan::call('make:controller', [
            'name' => $controller = $this->controllerWithoutMethod($this->action())
        ]);
        $this->addMethodToController($controller, $this->controllerMethod($this->action()));
        $this->info('Controller ' . $controller .' created.');
        $this->createView($this->argument('link'));
    }
1044760
function() {
		var i, j, item, controls,
		    config = this.config = this.system.config.input;

		for ( i = 0; i < config.length; i++ ) {
			item = config[ i ];
			
			this.setController( i, item.type );

			controls = item.controls;
			if ( !Array.isArray(controls) ) {
				controls = [ controls ];
			}

			for ( j = 0; j < controls.length; j++ ) {
				this.configure( i, controls[ j ].type, controls[ j ].config );
			}
		}
	}
74233
protected function initForm()
    {
        $name = isset($this->options['name']) ? $this->options['name'] : '';
        if(empty($name)){
            $name = 'form_'.(count(self::$forms)+1);
        }
        unset($this->options['name']);

        $this->form = tao_helpers_form_FormFactory::getForm($name, $this->options);

        //add translate action in toolbar
        $actions = tao_helpers_form_FormFactory::getCommonActions();

        //add a hidden form element that states that it is an Instance Form.
        $instanceElt = tao_helpers_form_FormFactory::getElement('tao.forms.instance', 'Hidden');
        $instanceElt->setValue('1');
        $this->form->addElement($instanceElt, true);

        //add a token to protect against xsrf
        $tokenElt = tao_helpers_form_FormFactory::getElement('token', 'Token');
        $tokenElt->addValidator(new XsrfTokenValidator());
        $this->form->addElement($tokenElt, true);

        $this->form->setActions($actions, 'top');
        $this->form->setActions($actions, 'bottom');
    }
939932
public function registerFormMapping()
    {
        // symfony
        FormHelper::registerFormTypeMapping([
            'form' => FormType::class,
            'birthday' => BirthdayType::class,
            'checkbox' => CheckboxType::class,
            'choice' => ChoiceType::class,
            'collection' => SymfonyCollectionType::class,
            'country' => CountryType::class,
            'date' => DateType::class,
            'datetime' => DateTimeType::class,
            'email' => EmailType::class,
            'file' => FileType::class,
            'hidden' => HiddenType::class,
            'integer' => IntegerType::class,
            'language' => LanguageType::class,
            'locale' => LocaleType::class,
            'money' => MoneyType::class,
            'number' => NumberType::class,
            'password' => PasswordType::class,
            'percent' => PercentType::class,
            'radio' => RadioType::class,
            'repeated' => RepeatedType::class,
            'search' => SearchType::class,
            'textarea' => TextareaType::class,
            'text' => TextType::class,
            'time' => TimeType::class,
            'timezone' => TimezoneType::class,
            'url' => UrlType::class,
            'button' => ButtonType::class,
            'submit' => SubmitType::class,
            'reset' => ResetType::class,
            'currency' => CurrencyType::class,
            'entity' => EntityType::class,
        ]);

        // core bundle
        FormHelper::registerFormTypeMapping([
            'sonata_type_immutable_array' => ImmutableArrayType::class,
            'sonata_type_boolean' => BooleanType::class,
            'sonata_type_collection' => CollectionType::class,
            'sonata_type_translatable_choice' => TranslatableChoiceType::class,
            'sonata_type_date_range' => DateRangeType::class,
            'sonata_type_datetime_range' => DateTimeRangeType::class,
            'sonata_type_date_picker' => DatePickerType::class,
            'sonata_type_datetime_picker' => DateTimePickerType::class,
            'sonata_type_date_range_picker' => DateRangePickerType::class,
            'sonata_type_datetime_range_picker' => DateTimeRangePickerType::class,
            'sonata_type_equal' => EqualType::class,
            'sonata_type_color' => ColorType::class,
            'sonata_type_color_selector' => ColorSelectorType::class,
        ]);

        $formTypes = [
            'form.type_extension.form.http_foundation',
            'form.type_extension.form.validator',
            'form.type_extension.csrf',
            'form.type_extension.form.data_collector',
        ];

        if (class_exists(DescriptionFormTypeExtension::class)) {
            $formTypes[] = 'nelmio_api_doc.form.extension.description_form_type_extension';
        }

        FormHelper::registerFormExtensionMapping('form', $formTypes);

        FormHelper::registerFormExtensionMapping('repeated', [
            'form.type_extension.repeated.validator',
        ]);

        FormHelper::registerFormExtensionMapping('submit', [
            'form.type_extension.submit.validator',
        ]);

        if ($this->container && $this->container->hasParameter('sonata.core.form.mapping.type')) {
            // from configuration file
            FormHelper::registerFormTypeMapping($this->container->getParameter('sonata.core.form.mapping.type'));
            foreach ($this->container->getParameter('sonata.core.form.mapping.extension') as $ext => $types) {
                FormHelper::registerFormExtensionMapping($ext, $types);
            }
        }
    }
572783
public function generateController()
    {
        if (!$this->confirm('Do you want to generate a controller?')) {
            return;
        }

        $this->console->call('generate:controller', [
            'name' => $this->getControllerName(),
            '--force' => $this->console->option('force'),
            '--scaffold' => true,
        ]);
    }
666244
private function form() {

    // Iterate through all the fields, rendering them
    foreach ( $this -> form_fields as $form_field ) {
      // Get Tag Type (input, select, option, button...)
      $tag_type = $form_field -> getTagType();
      $html_field = "";

      if( $this -> isUsingBootstrap() ){
        $html_field .= "<div class='form-group'>";
      }

      echo $form_field -> getFieldPreHTML();

      $html_field .= "<" . $tag_type . " ";
      $attributes = $form_field -> getAttributes();

      foreach ( $attributes as $att => $val ) {
        $html_field .= $att . "='" . $val . "' ";
      }
      // Remove last whitespace
      $html_field = rtrim($html_field);
      $html_field .= ">";

      if ( $tag_type == "button" || $tag_type == "a" || $tag_type == "select" ){
        if( $tag_type == "select" ){
          $options = $form_field -> getOptions();
          $values = $form_field -> getValues();
          // First option (Disabled)
          $html_field .= "<option value='' disabled='disabled' selected='true'>" . $form_field -> getFirstOption() . "</option>";
          foreach ($options as $option_key => $option_value ) {
            $html_field .= "<option value='" . $values[$option_key] . "'>" . $option_value . "</option>";
          }
          $html_field .= "</" . $tag_type . ">";
        }else{
          $html_field .= $form_field -> getInnerText();
          $html_field .= "</" . $tag_type . ">";
        }
      }

      if( $this -> isUsingBootstrap() ){
        $html_field .= "</div>";
      }

      echo $html_field;
    }

    echo $form_field -> getFieldPostHTML();
  }
632807
final public function populateFormOnce()
    {
        if (!$this->_formPopulated) {
            if (!empty($this->controller) && $this->controller->propagateId()) {
                $this->form->addElement(
                    'hidden', HTML_QuickForm2_Controller::KEY_ID,
                    array('id' => HTML_QuickForm2_Controller::KEY_ID)
                )->setValue($this->controller->getId());
            }
            $this->populateForm();
            $this->_formPopulated = true;
        }
    }
259434
protected function createComponentEditForm(): Form
	{
		$form = $this->formFactory->create();

		$form->addText('name', 'default.name')
			->setRequired();

		if ($this->editConst) {
			$form->addText('const', 'webManager.web.content.const')
				->setRequired();

			$form->addSelectUntranslated('locale', 'webManager.web.pages.locale')
				->setItems($this->localeService->allowed);
		}

		$form->addText('title', 'webManager.web.content.contentTitle')
			->addRule(Form::MAX_LENGTH, null, 150)
			->setRequired(false);

		$form->addTextArea('keywords', 'webManager.web.content.keywords');

		$form->addImageUpload('image', 'webManager.web.content.photo', 'webManager.web.content.photoDelete')
			->setNamespace('content')
			->setPreview('300x100');

		$form->addColor('background', 'webManager.web.content.background');

		$form->addTextArea('description', 'webManager.web.content.description');

		$form->addTextEditor('content', 'webManager.web.content.content');

		$form->addSubmit('save', 'form.save');

		$form->addLink('back', 'form.back', $this->getBacklink());

		$form->onSuccess[] = [$this, 'editFormSucceeded'];

		return $form;
	}
216494
public function init()
    {
        $this->registerMyJs();
        $display_none = '';

        if (ArrayHelper::remove($this->options, 'displayNone', true) === true) {
            $display_none = Yii::$app->request->get($this->model->formName())['search_form'] ? '' : 'display:none';
        }

        if ($this->submitButtonWrapperOptions !== false) {
            $this->submitButtonWrapperOptions = ArrayHelper::merge([
                'class' => 'col-md-12',
            ], $this->submitButtonWrapperOptions);
        }

        $tag = ArrayHelper::remove($this->options, 'tag', 'div');
        echo Html::beginTag($tag, ArrayHelper::merge([
            'id'    => $this->getDivId(),
            'class' => 'row',
            'style' => 'margin-bottom: 1rem; margin-top: 1rem; ' . $display_none,
        ], $this->options));

        $this->_form = ActiveForm::begin([
            'id'        => 'form-' . $this->getDivId(),
            'action'    => $this->action,
            'method'    => $this->method,
            'options'   => $this->formOptions,
            'fieldClass' => AdvancedSearchActiveField::class,
        ]);
        echo Html::hiddenInput(Html::getInputName($this->model, 'search_form'), 1);
    }
888352
public function init() {

		parent::init();

		// Views
		$this->setViewPath( '@cmsgears/module-cms/admin/views/form' );

		// Permission
		$this->crudPermission = FormsGlobal::PERM_FORM_ADMIN;

		// Config
		$this->type			= CoreGlobal::TYPE_FORM;
		$this->templateType	= CoreGlobal::TYPE_FORM;
		$this->apixBase		= 'cms/form';

		// Services
		$this->modelService		= Yii::$app->factory->get( 'formService' );
		$this->templateService	= Yii::$app->factory->get( 'templateService' );

		$this->modelContentService	= Yii::$app->factory->get( 'modelContentService' );

		// Sidebar
		$this->sidebar = [ 'parent' => 'sidebar-form', 'child' => 'form' ];

		// Return Url
		$this->returnUrl = Url::previous( 'forms' );
		$this->returnUrl = isset( $this->returnUrl ) ? $this->returnUrl : Url::toRoute( [ '/cms/form/all' ], true );

		// Breadcrumbs
		$this->breadcrumbs	= [
			'base' => [
				[ 'label' => 'Home', 'url' => Url::toRoute( '/dashboard' ) ]
			],
			'all' => [ [ 'label' => 'Forms' ] ],
			'create' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Add' ] ],
			'update' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Update' ] ],
			'delete' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Delete' ] ],
			'gallery' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Gallery' ] ],
			'data' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Data' ] ],
			'config' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Config' ] ],
			'settings' => [ [ 'label' => 'Forms', 'url' => $this->returnUrl ], [ 'label' => 'Settings' ] ]
		];
	}
1331876
protected function InitForm()
    {
        $this->html = $this->LoadElement();
        $name = 'Html';
        $this->AddRichTextField($name, $this->html->GetHtml());
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddCacheLifetimeField();
        $this->AddSubmit();
    }
480093
public function Form()
    {
        $form = new Form(
            $this,
            'SilverStripe\\Forms\\Form',
            new FieldList($root = new TabSet('Root', new Tab('Main'))),
            new FieldList()
        );

        if ($this->getTopLevelController() instanceof LeftAndMain) {
            $form->setTemplate('LeftAndMain_EditForm');
            $form->addExtraClass('cms-content cms-edit-form cms-tabset center');
            $form->setAttribute('data-pjax-fragment', 'CurrentForm Content');

            $root->setTemplate('CMSTabSet');
            $form->Backlink = $this->getBackLink();
        }

        return $form;
    }
1088486
private function generateController()
    {
        // Generate Controller class
        $controllerInstance = Controller::instance($this->columns, $this->viewType, $this);

        $controllerTemplateDir =
            dirname(dirname(__FILE__)).DS.'src'.DS.'Apps'.DS.'Controllers'.DS;

        $controllerInstance->setControllerTemplatePath($controllerTemplateDir);
        $controllerInstance->setApplicationDirectory($this->applicationDir);

        $controllerInstance->setControllerName($this->controller);
        $controllerInstance->setModelName($this->model);
        $controllerInstance->updateTemplate();
        $controllerInstance->generateControllerTemplate();

        $controllerInstance->generate();

        $this->info("Controller $this->controller Generated Successfully!");
    }
1140165
public function initForm()
    {
        
        $name = isset($this->options['name']) ? $this->options['name'] : 'form_'.(count(self::$forms)+1); 
		unset($this->options['name']);
		
        $this->form = tao_helpers_form_FormFactory::getForm($name, $this->options);
    	
		//add create action in toolbar
		$action = tao_helpers_form_FormFactory::getElement('save', 'Free');
		$value =  '<a href="#" class="form-submitter btn-success small"><span class="icon-save"></span> ' .__('Create').'</a>';

		$action->setValue($value);
		
		$this->form->setActions(array($action), 'top');
		$this->form->setActions(array($action), 'bottom');
        
    }