Returns the form definitions for the step

@param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
@return void
977018
protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
    {
        $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS,
            'Lightwerk.SurfCaptain');
        $driver = $settings['sources']['default']['driver'];

        $page1 = $formDefinition->createPage('page1');
        $page1->setRenderingOption('header', 'Configure your Git Repository for ' . $driver . ' Driver');

        $generalSection = $page1->createElement('generalSection', 'TYPO3.Form:Section');
        $generalSection->setLabel('General Settings');

        $repositories = $generalSection->createElement('repositories', 'TYPO3.Form:SingleLineText');
        $repositories->setLabel('Repositories (csv) (e.g. ' . $this->exampleData[$driver]['repositories'] . ')');
        $repositories->addValidator(new NotEmptyValidator());
        $existingRepositories = Arrays::getValueByPath($this->distributionSettings,
            'Lightwerk.SurfCaptain.sources.default.repositories');
        if (is_array($existingRepositories)) {
            $repositories->setDefaultValue(implode(',', $existingRepositories));
        }

        $driverSection = $page1->createElement('driverSection', 'TYPO3.Form:Section');
        $driverSection->setLabel('Driver Specific Settings');
        switch ($driver) {
            case 'GitHub':
                $privateToken = $driverSection->createElement('privateToken', 'TYPO3.Form:SingleLineText');
                $privateToken->setLabel('Private Token');
                $privateToken->addValidator(new NotEmptyValidator());
                $privateToken->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
                    'Lightwerk.SurfCaptain.sources.default.privateToken'));
                break;
            case 'GitLab':
                $privateToken = $driverSection->createElement('privateToken', 'TYPO3.Form:SingleLineText');
                $privateToken->setLabel('Private Token');
                $privateToken->addValidator(new NotEmptyValidator());
                $privateToken->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
                    'Lightwerk.SurfCaptain.sources.default.privateToken'));

                $apiUrl = $driverSection->createElement('apiUrl', 'TYPO3.Form:SingleLineText');
                $apiUrl->setLabel('Api Url (e.g. https://git.lightwerk.com/api/v3/)');
                $apiUrl->addValidator(new NotEmptyValidator());
                $apiUrl->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
                    'Lightwerk.SurfCaptain.sources.default.apiUrl'));

                $accountName = $driverSection->createElement('accountName', 'TYPO3.Form:SingleLineText');
                $accountName->setLabel('Account Name (e.g. git@git.lightwerk.com)');
                $accountName->addValidator(new NotEmptyValidator());
                $accountName->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
                    'Lightwerk.SurfCaptain.sources.default.accountName'));
                break;
            case 'BitBucket':
                $link = $driverSection->createElement('link', 'TYPO3.Setup:LinkElement');
                $link->setLabel('Read about OAuth on Bitbucket');
                $link->setProperty('href', 'https://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket');
                $link->setProperty('target', '_blank');
                $link->setProperty('elementClassAttribute', 'alert alert-info');

                $accountName = $driverSection->createElement('accountName', 'TYPO3.Form:SingleLineText');
                $accountName->setLabel('Account Name');
                $accountName->addValidator(new NotEmptyValidator());
                $accountName->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
                    'Lightwerk.SurfCaptain.sources.default.accountName'));

                $privateToken = $driverSection->createElement('privateToken', 'TYPO3.Form:SingleLineText');
                $privateToken->setLabel('Private Token');
                $privateToken->addValidator(new NotEmptyValidator());
                $privateToken->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
                    'Lightwerk.SurfCaptain.sources.default.privateToken'));

                $privateSecret = $driverSection->createElement('privateSecret', 'TYPO3.Form:SingleLineText');
                $privateSecret->setLabel('Private Secret');
                $privateSecret->addValidator(new NotEmptyValidator());
                $privateSecret->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
                    'Lightwerk.SurfCaptain.sources.default.privateSecret'));

                $accessToken = $driverSection->createElement('accessToken', 'TYPO3.Form:SingleLineText');
                $accessToken->setLabel('Access Token');
                $accessToken->addValidator(new NotEmptyValidator());
                $accessToken->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
                    'Lightwerk.SurfCaptain.sources.default.accessToken'));

                $accessSecret = $driverSection->createElement('accessSecret', 'TYPO3.Form:SingleLineText');
                $accessSecret->setLabel('Access Secret');
                $accessSecret->addValidator(new NotEmptyValidator());
                $accessSecret->setDefaultValue(Arrays::getValueByPath($this->distributionSettings,
                    'Lightwerk.SurfCaptain.sources.default.accessSecret'));
                break;
            default:
                throw new SetupException('Unknown driver ' . $driver, 1427623122);
        }

        $formDefinition->setRenderingOption('skipStepNotice',
            'If you skip this step make sure that you have configured your Git Repositories in Settings.yaml');
    }
1059384
public function buildFieldCreateForm(
        FormBuilderInterface $formBuilder,
        FieldDefinition $fieldDefinition,
        $languageCode
    ) {
        $this->buildFieldForm($formBuilder, $fieldDefinition, $languageCode);
    }
1089398
protected function appendFieldDefinition(NodeBuilder $fieldDefinition): void
    {
        $fieldDefinition
            ->scalarNode('type')->defaultValue('text')->end()
            ->scalarNode('label')->defaultNull()->end()
            ->scalarNode('form_type')->defaultNull()->end()
            ->arrayNode('attributes')
                ->prototype('scalar')->defaultNull()->end()
            ->end()
            ->variableNode('default')->defaultNull()->end()
            ->variableNode('options')
                ->defaultValue([])
                ->validate()
                ->ifTrue(function ($value) {
                    return !\is_array($value) && null !== $value;
                })
                ->thenInvalid('"options" configuration must be an array or left empty')
                ->end()
            ->end()
            ->variableNode('form_options')
                ->defaultValue([])
                ->validate()
                ->ifTrue(function ($value) {
                    return !\is_array($value) && null !== $value;
                })
                ->thenInvalid('"form_options" configuration must be an array or left empty')
                ->end()
            ->end();
    }
1369949
public function updateDefinition(WorkflowDefinition $definition)
    {
        $existingActions = array();

        $existing = $definition->Actions()->column('Title');
        $structure = array_keys($this->structure);

        $removeNames = array_diff($existing, $structure);

        foreach ($definition->Actions() as $action) {
            if (in_array($action->Title, $removeNames)) {
                $action->delete();
                continue;
            }
            $existingActions[$action->Title] = $action;
        }

        $actions = array();
        $transitions = new ArrayObject;
        $sort = 1;
        // now, go through the structure and create/realign things
        foreach ($this->structure as $relationName => $relationTemplate) {
            $isAction = isset($relationTemplate['type']);
            $isUsers = ($relationName == 'users');
            $isGroups = ($relationName == 'groups');

            if ($isAction) {
                $action = null;
                if (isset($existingActions[$relationName])) {
                    $action = $existingActions[$relationName];
                } else {
                    $action = $this->createAction($relationName, $relationTemplate, $definition, $transitions);
                }

                // add a sort value in!
                $action->Sort = $sort++;
                $action->write();

                $actions[$relationName] = $action;

                $newTransitions = $this->updateActionTransitions($relationTemplate, $action);
                foreach ($newTransitions as $t) {
                    $transitions->append($t);
                }
            }
            // Process users on WorkflowDefinition from the template
            if ($isUsers) {
                $this->createUsers($relationTemplate, $definition, true);
            }
            // Process groups on WorkflowDefinition from the template
            if ($isGroups) {
                $this->createGroups($relationTemplate, $definition, true);
            }
        }

        foreach ($transitions as $transition) {
            if (isset($actions[$transition->Target])) {
                $transition->NextActionID = $actions[$transition->Target]->ID;
            }
            $transition->write();
        }

        // Set the version and do the write at the end so that we don't trigger an infinite loop!!
        $definition->Description = $this->getDescription();
        $definition->TemplateVersion = $this->getVersion();
        $definition->RemindDays = $this->getRemindDays();
        $definition->Sort = $this->getSort();
        $definition->write();
    }
1326002
public function define_form(&$form) {
        $form->addElement('header', '_commonsettings', get_string('profilecommonsettings', 'admin'));
        $this->define_form_common($form);

        $form->addElement('header', '_specificsettings', get_string('profilespecificsettings', 'admin'));
        $this->define_form_specific($form);
    }
958727
protected function getElementId(Form $form)
    {
        /** @var Form $parent */
        $parent = $form->getParent();
        if (null !== $parent) {
            return $this->getElementId($parent) . '_' . $form->getName();
        } else {
            return $form->getName();
        }
    }
549398
private static function create_definition_object($definition) {
        global $CFG;

        $method = $definition['method'];
        $definitionobject = new stdClass();
        foreach ($definition as $key => $value) {
            if (!is_array($value)) {
                $definitionobject->$key = $value;
            }
        }
        $text = '';
        $format = FORMAT_MOODLE;
        if (isset($definition['description'])) {
            $text = $definition['description'];
            if (isset($definition['descriptionformat'])) {
                $format = $definition['descriptionformat'];
            }
        }
        $definitionobject->description_editor = array('text' => $text, 'format' => $format);

        require_once("$CFG->libdir/filelib.php");
        require_once($CFG->dirroot.'/grade/grading/form/'.$method.'/lib.php');
        $details  = call_user_func('gradingform_'.$method.'_controller::get_external_definition_details');
        $methodarray = array();
        foreach (array_keys($details) as $definitionkey) {
            $items = array();
            $idnumber = 1;
            foreach ($definition[$method][$definitionkey] as $item) {
                $processeditem = self::set_new_ids($item, $idnumber);
                $items[$processeditem['id']] = $processeditem;
                $idnumber++;
            }
            $definitionobjectkey = substr($definitionkey, strlen($method.'_'));
            $methodarray[$definitionobjectkey] = $items;
            $definitionobject->$method = $methodarray;
        }

        return $definitionobject;
    }
399279
public function definition() {
        $mform = $this->_form;

        $mform->addElement('header', 'database', get_string('dbexport', 'tool_dbtransfer'));
        $mform->addElement('textarea', 'description', get_string('description'), array('rows'=>5, 'cols'=>60));
        $mform->setType('description', PARAM_TEXT);

        $this->add_action_buttons(false, get_string('exportdata', 'tool_dbtransfer'));
    }
344259
private function appendProperForm(FormInterface $form, Definition $definition)
    {
        $identifier = $definition->getIdentifier();
        if ($form->has($identifier)) {
            return;
        }

        $type = sprintf('ekyna_%s_characteristic', $definition->getType());
        $options = array();
        if ($definition->getType() == 'choice') {
            $options['identifier'] = $identifier;
        }

        $parentData = null;
        if (null !== $this->parentDatas && null !== $characteristic = $this->parentDatas->findCharacteristicByIdentifier($identifier)) {
            $parentData = $characteristic->display($definition);
        }

        $form->add($identifier, $type, array_merge(array(
            'property_path' => '[' . $identifier . ']',
            'label' => $definition->getTitle(),
            'parent_data' => $parentData,
        ), $options));
    }
1065649
final protected function defineForm(StagedFormObjectDefinition $form)
    {
        $form->stage(function (FormObjectDefinition $form) {
            $form->section('Object', [
                    ObjectForm::objectField($form->field($this->object), $this->dataSource)
            ]);
        });

        $this->defineFormStages($form);
    }
95977
protected function addStepElementsFor(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model, $step)
    {
        $this->displayHeader($bridge, $this->getFormTitle($step), 'h2');

        switch ($step) {
            case 2:
                $this->addStepFileCheck($bridge, $model);
                break;

            case 3:
                $this->addStepChangeTrack($bridge, $model);
                break;

            case 4:
                if ($this->trackEngine) {
                    $this->addStepRoundMatch($bridge, $model);
                } else {
                    $this->addStepCreateTrack($bridge, $model);
                }
                break;

            case 5:
                if ($this->trackEngine) {
                    $this->addStepMergeTrack($bridge, $model);
                    break;
                }
                // Intentional faal through

            default:
                $this->addStepFileImport($bridge, $model);
                break;

        }
    }
1153825
public function getFieldDefinition($fieldDefinitionIdentifier)
    {
        if (isset($this->fieldDefinitionsByIdentifier[$fieldDefinitionIdentifier])) {
            return $this->fieldDefinitionsByIdentifier[$fieldDefinitionIdentifier];
        }

        return null;
    }
1262699
final public function getFormDefinition(\Closure $callback)
    {
        $fullyQualifiedClassName = get_class($this);
        $formIdentifier = lcfirst(substr($fullyQualifiedClassName, strrpos($fullyQualifiedClassName, '\\') + 1));
        $formConfiguration = $this->getPresetConfiguration($this->presetName);
        $formDefinition = new FormDefinition($formIdentifier, $formConfiguration);
        $this->buildForm($formDefinition);

        $closureFinisher = new \Neos\Form\Finishers\ClosureFinisher();
        $closureFinisher->setOption('closure', $callback);
        $formDefinition->addFinisher($closureFinisher);

        return $formDefinition;
    }
447908
private function getOptions(InputDefinition $definition, array $options): array
    {
        $argv = [];
        foreach ($options as $name => $value) {
            $definition->getOption($name) && $argv[] = sprintf('--%s=%s', $name, $value);
        }
        return $argv;
    }
317437
public function mapEntities(array $entityDefinitions)
	{
		foreach($entityDefinitions as $entityIdentifier => $entityDefinition)
		{
			$this->validateAndCompleteEntity($entityIdentifier, $entityDefinition);
		}
	}
62349
protected function definition() {
        $mform = $this->_form;

        // Standard fields at the start of the form.
        $mform->addElement('header', 'generalheader', get_string("general", 'form'));

        $mform->addElement('questioncategory', 'category', get_string('category', 'question'),
                array('contexts' => $this->contexts->having_cap('moodle/question:useall'), 'top' => true));

        $mform->addElement('advcheckbox', 'questiontext[text]',
                get_string('includingsubcategories', 'qtype_random'), null, null, array(0, 1));

        $tops = question_get_top_categories_for_contexts(array_column($this->contexts->all(), 'id'));
        $mform->hideIf('questiontext[text]', 'category', 'in', $tops);

        $mform->addElement('hidden', 'qtype');
        $mform->setType('qtype', PARAM_ALPHA);

        $this->add_hidden_fields();

        $buttonarray = array();
        $buttonarray[] = $mform->createElement('submit', 'submitbutton', get_string('savechanges'));
        $buttonarray[] = $mform->createElement('cancel');
        $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
        $mform->closeHeaderBefore('buttonar');
    }
973403
private function resolveDefinition(ChildDefinition $definition)
    {
        try {
            return $this->doResolveDefinition($definition);
        } catch (ExceptionInterface $e) {
            $r = new \ReflectionProperty($e, 'message');
            $r->setAccessible(true);
            $r->setValue($e, sprintf('Service "%s": %s', $this->currentId, $e->getMessage()));

            throw $e;
        }
    }