-
-
Save bwaidelich/7b0a0ef2b6c49f0c223f9b83d0f72083 to your computer and use it in GitHub Desktop.
Flow Form Framework: Persist form state on each page
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
type: 'Neos.Form:Form' | |
identifier: persist-test | |
renderables: | |
- | |
type: 'Neos.Form:Page' | |
identifier: page1 | |
renderables: | |
- | |
type: 'Neos.Form:SingleLineText' | |
identifier: name | |
label: Name | |
validators: | |
- | |
identifier: 'Neos.Flow:NotEmpty' | |
- | |
type: 'Neos.Form:MultiLineText' | |
identifier: comment | |
label: Comment | |
- | |
type: 'Your.Package:PersistPage' | |
identifier: page2 | |
renderables: | |
- | |
type: 'Neos.Form:SingleLineText' | |
identifier: foo | |
label: singlelinetext1 | |
validators: | |
- | |
identifier: 'Neos.Flow:NotEmpty' | |
properties: | |
placeholder: placey | |
defaultValue: defaulty | |
- | |
type: 'Neos.Form:PreviewPage' | |
identifier: previewpage1 | |
label: previewpage1 |
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 | |
namespace Your\Package; | |
use Neos\Form\Core\Model\Page; | |
use Neos\Form\Core\Runtime\FormRuntime; | |
class PersistPage extends Page | |
{ | |
public function beforeRendering(FormRuntime $formRuntime) | |
{ | |
// TODO persist $formRuntime->getFormState()->getFormValues() | |
} | |
} |
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: | |
<PRESET_NAME>: | |
formElementTypes: | |
'Your.Package:PersistPage': | |
superTypes: | |
'Neos.Form:Page': true | |
renderingOptions: | |
# OPTIONAL: Use the default page's template | |
templatePathPattern: 'resource://Neos.Form/Private/Form/Page.html' | |
implementationClassName: Your\Page\PersistPage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't forget to replace
PRESET_NAME
with your preset (or "default" to make it available to all sub-presets) andYour.Package
with your package key