-
-
Save bwaidelich/c2d5afc2759c17cae030104f8bb8fcde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Wwwision\Test; | |
use Neos\Flow\Validation\Validator\NotEmptyValidator; | |
use Neos\Form\Core\Model\FormDefinition; | |
use Neos\Form\Factory\AbstractFormFactory; | |
final class FormFactory extends AbstractFormFactory | |
{ | |
public function build(array $factorySpecificConfiguration, $presetName) { | |
$formConfiguration = $this->getPresetConfiguration($presetName); | |
$form = new FormDefinition('testform', $formConfiguration); | |
$page1 = $form->createPage('page1'); | |
$password = $page1->createElement('password', 'Neos.Form:Password'); | |
$password->addValidator(new NotEmptyValidator()); | |
$password->setLabel('Password'); | |
$confirmation = $page1->createElement('confirmation', 'Wwwision.Test:PasswordConfirmation'); | |
$confirmation->setLabel('Confirm'); | |
return $form; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Wwwision\Test\Form\Elements; | |
use Neos\Form\Core\Model\AbstractFormElement; | |
use Neos\Form\Core\Runtime\FormRuntime; | |
final class PasswordConfirmation extends AbstractFormElement | |
{ | |
public function onSubmit(FormRuntime $formRuntime, &$elementValue) | |
{ | |
\Neos\Flow\var_dump($formRuntime->getFormState()->getFormValues(), 'form values'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Neos: | |
Form: | |
presets: | |
default: | |
formElementTypes: | |
'Wwwision.Test:PasswordConfirmation': | |
superTypes: | |
'Neos.Form:FormElement': true | |
implementationClassName: Wwwision\Test\Form\Elements\PasswordConfirmation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment