/** * Returns the form definitions for the step * * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition * @return void */ protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition) { $page1 = $formDefinition->createPage('page1'); $page1->setRenderingOption('header', 'Create administrator account'); $introduction = $page1->createElement('introduction', 'TYPO3.Form:StaticText'); $introduction->setProperty('text', 'Enter the personal data and credentials for your backend account:'); $personalSection = $page1->createElement('personalSection', 'TYPO3.Form:Section'); $personalSection->setLabel('Personal Data'); $firstName = $personalSection->createElement('firstName', 'TYPO3.Form:SingleLineText'); $firstName->setLabel('First name'); $firstName->addValidator(new NotEmptyValidator()); $firstName->addValidator(new StringLengthValidator(array('minimum' => 1, 'maximum' => 255))); $lastName = $personalSection->createElement('lastName', 'TYPO3.Form:SingleLineText'); $lastName->setLabel('Last name'); $lastName->addValidator(new NotEmptyValidator()); $lastName->addValidator(new StringLengthValidator(array('minimum' => 1, 'maximum' => 255))); $credentialsSection = $page1->createElement('credentialsSection', 'TYPO3.Form:Section'); $credentialsSection->setLabel('Credentials'); $username = $credentialsSection->createElement('username', 'TYPO3.Form:SingleLineText'); $username->setLabel('Username'); $username->addValidator(new NotEmptyValidator()); $username->addValidator(new UserDoesNotExistValidator()); $password = $credentialsSection->createElement('password', 'TYPO3.Form:PasswordWithConfirmation'); $password->addValidator(new NotEmptyValidator()); $password->addValidator(new StringLengthValidator(array('minimum' => 6, 'maximum' => 255))); $password->setLabel('Password'); $password->setProperty('passwordDescription', 'At least 6 characters'); $formDefinition->setRenderingOption('skipStepNotice', 'If you skip this step make sure that you have an existing user or create one with the user:create command'); }
/** * @test */ public function getRenderingOptionsReturnsRenderingOptionsOfFormDefinition() { $formDefinition = new FormDefinition('foo'); $formDefinition->setRenderingOption('asdf', 'test'); $formRuntime = $this->createFormRuntime($formDefinition); $this->assertSame(['asdf' => 'test'], $formRuntime->getRenderingOptions()); }
/** * Returns the form definitions for the step * * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition * @return void */ protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition) { $page1 = $formDefinition->createPage('page1'); $page1->setRenderingOption('header', 'Select your Git Driver'); $driverSection = $page1->createElement('driverSection', 'TYPO3.Form:Section'); $gitDriver = $driverSection->createElement('gitDriver', 'TYPO3.Form:SingleSelectDropdown'); $gitDriver->setLabel('Git Driver'); $gitDriver->setProperty('options', array('GitHub' => 'Git Hub', 'GitLab' => 'Git Lab', 'BitBucket' => 'Bit Bucket')); $gitDriver->addValidator(new NotEmptyValidator()); $gitDriver->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.sources.default.driver')); $formDefinition->setRenderingOption('skipStepNotice', 'If you skip this step make sure that you have configured your Git Repositories in Settings.yaml'); }
/** * Returns the form definitions for the step * * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition * @return void */ protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition) { $page1 = $formDefinition->createPage('page1'); $page1->setRenderingOption('header', 'Deployment Settings'); $deploymentSection = $page1->createElement('deploymentSection', 'TYPO3.Form:Section'); $user = $deploymentSection->createElement('defaultUser', 'TYPO3.Form:SingleLineText'); $user->setLabel('Deployment user. Default SSH user for deployment on target systems (optional, will be configurable per target system later on).'); $user->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.frontendSettings.defaultUser')); $path = $deploymentSection->createElement('defaultDeploymentPath', 'TYPO3.Form:SingleLineText'); $path->setLabel('Deployment Path. Default target path for deployments, e.g. "/var/www/{{project}}/{{suffix}}/htdocs/" (optional, will be configurable per target system later on ).'); $path->setDefaultValue(Arrays::getValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.frontendSettings.defaultDeploymentPath')); $formDefinition->setRenderingOption('skipStepNotice', 'You can always configure your frontend settings later in Settings.yaml'); }
/** * Returns the form definitions for the step * * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition * @return void */ protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition) { $page1 = $formDefinition->createPage('page1'); $page1->setRenderingOption('header', 'Create a new site'); $introduction = $page1->createElement('introduction', 'TYPO3.Form:StaticText'); $introduction->setProperty('text', 'There are two ways of creating a site. Choose between the following:'); $importSection = $page1->createElement('import', 'TYPO3.Form:Section'); $importSection->setLabel('Import a site from an existing site package'); $sitePackages = array(); foreach ($this->packageManager->getFilteredPackages('available', NULL, 'typo3-flow-site') as $package) { $sitePackages[$package->getPackageKey()] = $package->getPackageKey(); } if (count($sitePackages) > 0) { $site = $importSection->createElement('site', 'TYPO3.Form:SingleSelectDropdown'); $site->setLabel('Select a site package'); $site->setProperty('options', $sitePackages); $site->addValidator(new \TYPO3\Flow\Validation\Validator\NotEmptyValidator()); $sites = $this->siteRepository->findAll(); if ($sites->count() > 0) { $prune = $importSection->createElement('prune', 'TYPO3.Form:Checkbox'); $prune->setLabel('Delete existing sites'); } } else { $error = $importSection->createElement('noSitePackagesError', 'TYPO3.Form:StaticText'); $error->setProperty('text', 'No site packages were available, make sure you have an active site package'); $error->setProperty('elementClassAttribute', 'alert alert-warning'); } if ($this->packageManager->isPackageActive('TYPO3.Neos.Kickstarter')) { $separator = $page1->createElement('separator', 'TYPO3.Form:StaticText'); $separator->setProperty('elementClassAttribute', 'section-separator'); $newPackageSection = $page1->createElement('newPackageSection', 'TYPO3.Form:Section'); $newPackageSection->setLabel('Create a new site package with a dummy site'); $packageName = $newPackageSection->createElement('packageKey', 'TYPO3.Form:SingleLineText'); $packageName->setLabel('Package Name (in form "Vendor.DomainCom")'); $packageName->addValidator(new \TYPO3\Neos\Validation\Validator\PackageKeyValidator()); $siteName = $newPackageSection->createElement('siteName', 'TYPO3.Form:SingleLineText'); $siteName->setLabel('Site Name (e.g. "domain.com")'); } else { $error = $importSection->createElement('neosKickstarterUnavailableError', 'TYPO3.Form:StaticText'); $error->setProperty('text', 'The Neos Kickstarter package (TYPO3.Neos.Kickstarter) is not installed, install it for kickstarting new sites (using "composer require typo3/neos-kickstarter")'); $error->setProperty('elementClassAttribute', 'alert alert-warning'); } $explanation = $page1->createElement('explanation', 'TYPO3.Form:StaticText'); $explanation->setProperty('text', 'Notice the difference between a site package and a site. A site package is a Flow package that can be used for creating multiple site instances.'); $explanation->setProperty('elementClassAttribute', 'alert alert-info'); $step = $this; $callback = function (\TYPO3\Form\Core\Model\FinisherContext $finisherContext) use($step) { $step->importSite($finisherContext); }; $this->closureFinisher = new \TYPO3\Form\Finishers\ClosureFinisher(); $this->closureFinisher->setOption('closure', $callback); $formDefinition->addFinisher($this->closureFinisher); $formDefinition->setRenderingOption('skipStepNotice', 'You can always import a site using the site:import command'); }
/** * Returns the form definitions for the step * * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition * @return void */ 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'); }