Neos\Neos\Setup\Step\AdministratorStep::buildForm PHP Method

buildForm() protected method

Returns the form definitions for the step
protected buildForm ( Neos\Form\Core\Model\FormDefinition $formDefinition ) : void
$formDefinition Neos\Form\Core\Model\FormDefinition
return void
    protected function buildForm(FormDefinition $formDefinition)
    {
        $page1 = $formDefinition->createPage('page1');
        $page1->setRenderingOption('header', 'Create administrator account');
        $introduction = $page1->createElement('introduction', 'Neos.Form:StaticText');
        $introduction->setProperty('text', 'Enter the personal data and credentials for your backend account:');
        $personalSection = $page1->createElement('personalSection', 'Neos.Form:Section');
        $personalSection->setLabel('Personal Data');
        $firstName = $personalSection->createElement('firstName', 'Neos.Form:SingleLineText');
        $firstName->setLabel('First name');
        $firstName->addValidator(new NotEmptyValidator());
        $firstName->addValidator(new StringLengthValidator(array('minimum' => 1, 'maximum' => 255)));
        $lastName = $personalSection->createElement('lastName', 'Neos.Form:SingleLineText');
        $lastName->setLabel('Last name');
        $lastName->addValidator(new NotEmptyValidator());
        $lastName->addValidator(new StringLengthValidator(array('minimum' => 1, 'maximum' => 255)));
        $credentialsSection = $page1->createElement('credentialsSection', 'Neos.Form:Section');
        $credentialsSection->setLabel('Credentials');
        $username = $credentialsSection->createElement('username', 'Neos.Form:SingleLineText');
        $username->setLabel('Username');
        $username->addValidator(new NotEmptyValidator());
        $username->addValidator(new UserDoesNotExistValidator());
        $password = $credentialsSection->createElement('password', 'Neos.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');
    }