Skip to content

Instantly share code, notes, and snippets.

@bwaidelich
Last active July 26, 2017 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwaidelich/7b0a0ef2b6c49f0c223f9b83d0f72083 to your computer and use it in GitHub Desktop.
Save bwaidelich/7b0a0ef2b6c49f0c223f9b83d0f72083 to your computer and use it in GitHub Desktop.
Flow Form Framework: Persist form state on each page
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
<?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()
}
}
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
@bwaidelich
Copy link
Author

Don't forget to replace PRESET_NAME with your preset (or "default" to make it available to all sub-presets) and Your.Package with your package key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment