mapseven / neos-formbundle
Bundle package for Neos CMS Form stuff
Installs: 1 378
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 3
Open Issues: 0
Type:neos-package
Requires
- flowpack/elasticsearch: *
- neos/flow: ^4.0 || ^5.0 || dev-master
- neos/form: *
This package is not auto-updated.
Last update: 2024-10-26 19:43:10 UTC
README
This Bundle contains various stuff to work with the Neos.Form Package in Neos CMS
Installation
composer require mapseven/neos-formbundle
Features
- Persistence Finisher - store submitted formData in a repository and/or ElasticSearch
Usage
This Package contains only the Finishers and Helpers you can use in your Packages. You'll find the Examples in the FormBundleDemo
Persistence Finisher
Just add the following finisher to the form.yaml
#... finishers: 'MapSeven.Neos.FormBundle:Persistence': identifier: 'MapSeven.Neos.FormBundle:Persistence' options: db: true elasticSearch: false
The default options for the Persistence Finisher are those from the example above. Change them to your needs.
Override Configuration from NodeType Settings
By adding the options to the NodeTypes Configuration you can override the Options from the form.yaml
with the NodeTypes Settings
Add the properties you want to override to the NodeTypes.yaml
'MapSeven.Neos.FormBundleDemo:Form': superTypes: 'Neos.NodeTypes:Form': true ui: label: Demo Form icon: 'icon-envelope-alt' inspector: groups: persistenceOptions: label: Persistence Options position: 40 properties: #... db: type: boolean defaultValue: true ui: label: Repository inspector: group: persistenceOptions elasticSearch: type: boolean defaultValue: false ui: label: Elastic Search inspector: group: persistenceOptions
Override the Configuration with the Settings from the NodeType in the form.html
Template
{namespace formBundle=MapSeven\Neos\FormBundle\ViewHelpers} <div{attributes -> f:format.raw()}> <f:if condition="{formIdentifier}"> <f:then> <formBundle:render persistenceIdentifier="{formIdentifier}" presetName="{presetName}" overrideConfiguration="{finishers: {'MapSeven.Neos.FormBundle:Persistence': {options: {db: node.properties.db, elasticSearch: node.properties.elasticSearch}}}}" /> </f:then> <f:else> <p>Please select a valid Form identifier in the inspector</p> </f:else> </f:if> </div>
Note: This example uses an adjusted form viewHelper, which unsets the finisher in case the form.yaml
doesn't contain that finisher configuration
ElasticSearch Mapping
This Package uses the Flowpack/Elasticsearch Package for Indexing FormData into ElasticSearch. That means you can use the Settings and other Features from that package. Have a look at the Settings.yaml
for an example analyzer configuration I used for a facetted search.
Besides that you can define the mapping and transformers for each form item in a similar way in the form.yaml
.
#... renderables: - type: 'Neos.Form:MultipleSelectCheckboxes' identifier: category label: 'Categories' properties: elementClassAttribute: 'checkbox' elementErrorClassAttribute: 'state-error' containerClassAttribute: '' options: cat1: Category 1 cat2: Category 2 cat3: Category 3 elasticSearch: mapping: type: string analyzer: string_lowercase fields: raw: type: string index: not_analyzed
License
Neos FormBundle is licensed under the MIT Licence