Adds some default configuration. I.e. form name and layout class.

@inheritdoc
421406
public function init ()
		{
			if (!in_array($this->layout, [ 'default', 'horizontal', 'inline' ]))
				throw new InvalidConfigException('Invalid layout type: ' . $this->layout);

			if ($this->layout !== 'default')
				Html::addCssClass($this->options, 'form-' . $this->layout);

			if ($this->name)
				$this->options[ 'name' ] = $this->name;

			parent::init();
		}
671402
protected function InitForm()
    {
        $this->container = $this->LoadElement();
        $this->AddContainerField();
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddSubmit();
    }
1054025
protected function createComponentEditForm(): Form
	{
		$form = $this->formFactory->create();
		$form->addProtection();

		$form->addText('username', 'cms.user.username')
			->setDefaultValue($this->currentUser->username)
			->setRequired();
		$form->addText('firstName', 'cms.user.firstName')
			->setDefaultValue($this->currentUser->firstName);
		$form->addText('surname', 'cms.user.surname')
			->setDefaultValue($this->currentUser->surname);
		$form->addText('email', 'cms.user.email')
			->setDefaultValue($this->currentUser->email)
			->setRequired()
			->addRule(Form::EMAIL);
		$form->addPhone('phone', 'cms.user.phone')
			->setDefaultValue($this->currentUser->phone);

		$language = $form->addSelectUntranslated('language', 'cms.user.language', $this->localeService->allowed, 'form.none');
		if (!empty($this->currentUser->language)) {
			$locale = $this->localeService->get($this->currentUser->language);
			if ($locale) {
				$language->setDefaultValue($locale->id);
			}
		}

		$roles = $form->addMultiSelectUntranslated('roles', 'cms.permissions.roles', $this->orm->aclRoles->fetchPairs($this->user->isAllowed('dockbar.settings.permissions.superadmin', 'view')))
			->setRequired();
		try {
			$roles->setDefaultValue($this->currentUser->roles->getRawValue());
		} catch (InvalidArgumentException $ex) {

		}

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

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

		return $form;
	}
847769
public function addPHPConfig($filename)
    {
        $filename = trim($filename);
        
        if (strlen($filename) === 0) {
            throw new ConfiguratorException("Zero length filename is bogus.");
        }
        
        if (file_exists($filename) === false) {
            throw new ConfiguratorException("File `$filename` does not exist.");
        }
        
        ob_start();
        require($filename);
        $contents = ob_get_contents();
        ob_end_clean();

        if (strlen($contents) !== 0) {
            $message = sprintf(
                "Filename `%s` output some characters. Please check it is a valid PHP file.\n",
                $filename
            );

            throw new ConfiguratorException($message);
        }

        if (isset($default) === true) {
            $this->configuratorData->addConfigDefault($default);
        }

        foreach ($this->environmentList as $environment) {
            if (isset($$environment) === true) {
                $this->configuratorData->addConfigEnvironment($$environment);
            }
        }

        if (isset($override) === true) {
            $this->configuratorData->addConfigOverride($override);
        }

        if (isset($evaluate) === true) {
            $calculatedValues = $evaluate($this->configuratorData->getConfig(), $this->environment);
            $this->configuratorData->addConfigOverride($calculatedValues);
        }
    }
660425
protected function setDefaultFieldDefinitions() : void
    {
        $table = $this->config->getTable();
        $field = $this->config->getField();
        $dbFieldType = $this->getDbFieldType();

        // set $options['fieldDefinitions']
        $stubFields = [
            $field => [
                'name' => $field,
                'type' => $dbFieldType,
            ],
        ];
        if ($table instanceof HasFieldsInterface) {
            $fieldDefinitions = $table->getFieldsDefinitions($stubFields);
            $this->defaultOptions['fieldDefinitions'] = new CsvField($fieldDefinitions[$field]);
        }

        // This should never be the case, except, maybe
        // for some unit test runs or custom non-CSV
        // modules.
        if (empty($this->defaultOptions['fieldDefinitions'])) {
            $this->defaultOptions['fieldDefinitions'] = new CsvField($stubFields[$field]);
        }
    }
775110
protected function init()
    {
        parent::init();
        $this->addConfigurations(array(
            static::CFG_FILENAME                      => 'Entity/%entity%.%extension%',
            static::CFG_GENERATE_ENTITY_POPULATE      => true,
            static::CFG_GENERATE_ENTITY_GETARRAYCOPY  => true,
        ));
    }
1082687
private function addAjaxPropertyForEditAll()
    {
        $inputProvider = $this->getEnvironment()->getInputProvider();

        if (('select' !== $inputProvider->getParameter('act'))
            && ('edit' !== $inputProvider->getParameter('select'))
            && ('edit' !== $inputProvider->getParameter('mode'))
        ) {
            return;
        }

        $originalProperty = $this->findOriginalPropertyByModelId($inputProvider->getValue('name'));
        if (null === $originalProperty) {
            return;
        }

        $propertiesDefinition = $this->getEnvironment()->getDataDefinition()->getPropertiesDefinition();

        $propertyClass = \get_class($originalProperty);

        $property = new $propertyClass($inputProvider->getValue('name'));
        $property->setLabel($originalProperty->getLabel());
        $property->setDescription($originalProperty->getDescription());
        $property->setDefaultValue($originalProperty->getDefaultValue());
        $property->setExcluded($originalProperty->isExcluded());
        $property->setSearchable($originalProperty->isSearchable());
        $property->setFilterable($originalProperty->isFilterable());
        $property->setWidgetType($originalProperty->getWidgetType());
        $property->setExplanation($originalProperty->getExplanation());
        $property->setExtra($originalProperty->getExtra());

        $propertiesDefinition->addProperty($property);
    }
148514
public function forTemplate()
    {
        $defaultStyles = $this->config()->get('default_styles');
        if ($this->config()->get('include_default_styles') && !empty($defaultStyles)) {
            foreach ($defaultStyles as $stylePath) {
                Requirements::css($stylePath);
            }
        }

        $template = $this->element->config()->get('controller_template');

        return $this->renderWith([
            'type' => 'Layout',
            'DNADesign\\Elemental\\'.$template
        ]);
    }
654394
public function updateEditForm($form)
    {
        if ($doadd = Config::inst()->get('ModelAdmin', 'addbetterimporters')) {
            $modelclass = $this->owner->modelClass;
            $grid = $form->Fields()->fieldByName($modelclass);
            $config =  $grid->getConfig();

            //don't proceed if there is already an importer
            if ($config->getComponentByType("GridFieldImporter")) {
                return;
            }
            //don't proceed if can't create
            if (!singleton($modelclass)->canCreate(Member::currentUser())) {
                return;
            }
            //allow config to avoid adding when there are existing importers
            $importerClasses = $this->owner->stat('model_importers');
            if (
                $doadd === "scaffolded" &&
                !is_null($importerClasses) &&
                isset($importerClasses[$modelclass])
            ) {
                return;
            }
            
            //add the component
            $config->addComponent(new GridFieldImporter('before'));
        }
    }
59029
public function formInputConfig()
    {
        $formConfig = parent::formInputConfig();

        if (!array_key_exists('options', $formConfig)) {
            $options = $this->config('options');
            $finder = $this->config('finder');
            if (!empty($options) && is_array($options)) {
                $formConfig['options'] = $options;
            } elseif ($this->_allowedEmptyOptions()) {
            } elseif (!empty($finder)) {
                $formConfig['options'] = $finder;
            }
        }

        return $formConfig;
    }
660756
public function edit_field_set_default($mform) {
        $key = $this->field->defaultdata;
        if (isset($this->options[$key]) || ($key = array_search($key, $this->options)) !== false){
            $defaultkey = $key;
        } else {
            $defaultkey = '';
        }
        $mform->setDefault($this->inputname, $defaultkey);
    }
959978
public function setDefaultsFromConfiguration()
    {
        if ($this->options['dsn']) {
            $dsn = explode(':', $this->options['dsn']);
            $this->setSQLDialect($dsn[0]);
        }

        $this->setTablePrefix($this->options['table_prefix']);
    }
228388
protected function configure()
    {
        $this->setDescription($this->shortDesc);

        foreach($this->paramsArray as $nameParam => $arrayOptions){
            if($arrayOptions['optional']){
                $this->addOption($nameParam, null, InputOption::VALUE_OPTIONAL, $arrayOptions['comment'], null);
            }
            else {
                $this->addOption($nameParam, null, InputOption::VALUE_REQUIRED, $arrayOptions['comment'], null);
            } 
        }
    }
1245410
protected function createComponentSettingsForm(): Form
	{
		$form = $this->formFactory->create();

		$form->addImageUpload('logo', 'webManager.web.settings.logo', 'webManager.web.settings.deleteLogo')
			->setNamespace('front')
			->setPreview('300x100');
		$form->addText('title', 'webManager.web.settings.pagesTitle');
		$form->addTextArea('keywords', 'webManager.web.settings.keywords');
		$form->addTextArea('description', 'webManager.web.settings.description');

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

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

		return $form;
	}
1059845
public function layout($layout)
    {
        // Save the layout
        if ($layout == 'control group') {
            $layout = 'form';
        }

        // Backwards compat
        if (in_array($layout, ['full', 'sidebar', 'form'])) {
            $this->layout = $layout;
        }

        // Make the default width of form layout a span9.  Because typically the form
        // layout is only used on full width forms
        if ($layout == 'form') {
            $this->addClass('span9');
        }

        // Chain
        return $this;
    }
137945
protected function configure()
    {
        $this->setName(static::NAME);
        $this->setDescription(static::DESCRIPTION);

        foreach ($this->defineOptions() as $option) {
            call_user_func_array([$this, 'addOption'], $option);
        }

        foreach ($this->defineArguments() as $argument) {
            call_user_func_array([$this, 'addArgument'], $argument);
        }
    }
1099030
protected function _addDefaultSelectTypes()
    {
        $typeMap = $this->getTypeMap()->getDefaults();
        $select = $this->clause('select');
        $types = [];

        foreach ($select as $alias => $value) {
            if (isset($typeMap[$alias])) {
                $types[$alias] = $typeMap[$alias];
                continue;
            }
            if (is_string($value) && isset($typeMap[$value])) {
                $types[$alias] = $typeMap[$value];
            }
            if ($value instanceof TypedResultInterface) {
                $types[$alias] = $value->getReturnType();
            }
        }
        $this->getSelectTypeMap()->addDefaults($types);
    }