Skip to content

Commit

Permalink
Merge pull request #34 from kdambekalns/3.0
Browse files Browse the repository at this point in the history
TASK: Adjust to Flow 4.0
  • Loading branch information
robertlemke committed Jan 27, 2017
2 parents d14e9c5 + b145f25 commit 9d8a5b7
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 80 deletions.
6 changes: 3 additions & 3 deletions Classes/Factory/AbstractFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
* definition.
*
* The AbstractFormFactory loads the presets from the package settings, from the
* YAML key *TYPO3: Form: presets: [presetName]*.
* YAML key *Neos: Form: presets: [presetName]*.
*
* The YAML preset definition has the following structure:
*
* <pre>
* TYPO3:
* Neos:
* Form:
* presets:
* default:
Expand Down Expand Up @@ -130,7 +130,7 @@ public function initializeObject()
public function getPresetConfiguration($presetName)
{
if (!isset($this->formSettings['presets'][$presetName])) {
throw new \Neos\Form\Exception\PresetNotFoundException(sprintf('The Preset "%s" was not found underneath TYPO3: Form: presets.', $presetName), 1325685498);
throw new \Neos\Form\Exception\PresetNotFoundException(sprintf('The Preset "%s" was not found underneath Neos: Form: presets.', $presetName), 1325685498);
}
$preset = $this->formSettings['presets'][$presetName];
if (isset($preset['parentPreset'])) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Finishers/EmailFinisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function executeInternal()
throw new FinisherException('The option "senderAddress" must be set for the EmailFinisher.', 1327060210);
}

$mail = new \TYPO3\SwiftMailer\Message();
$mail = new \Neos\SwiftMailer\Message();

$mail
->setFrom(array($senderAddress => $senderName))
Expand Down
40 changes: 20 additions & 20 deletions Documentation/adjusting-form-output.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ file, like in the following example:

.. code-block:: yaml
TYPO3:
Neos:
Form:
presets:
preset1:
Expand Down Expand Up @@ -160,7 +160,7 @@ contents:

.. code-block:: yaml
TYPO3:
Neos:
Form:
presets:
myCustom:
Expand Down Expand Up @@ -221,7 +221,7 @@ Adjust ``Your.Package/Configuration/Settings.yaml`` accordingly:

.. code-block:: yaml
TYPO3:
Neos:
Form:
presets:
myCustom:
Expand Down Expand Up @@ -361,27 +361,27 @@ Now, you only need to adjust the form definition in order to use the new templat

.. code-block:: yaml
TYPO3:
Neos:
Form:
presets:
########### CUSTOM PRESETS ###########
presets:
########### CUSTOM PRESETS ###########
myCustom:
title: 'Custom Elements'
parentPreset: 'default'
formElementTypes:
myCustom:
title: 'Custom Elements'
parentPreset: 'default'
formElementTypes:
# ...
# ...
### override template path of Neos.Form:Form ###
'Neos.Form:Form':
renderingOptions:
templatePathPattern: 'resource://Neos.FormExample/Private/CustomElements/Form.html'
### override template path of Neos.Form:Form ###
'Neos.Form:Form':
renderingOptions:
templatePathPattern: 'resource://Neos.FormExample/Private/CustomElements/Form.html'
### override default layout path ###
'Neos.Form:Base':
renderingOptions:
layoutPathPattern: 'resource://Neos.FormExample/Private/CustomElements/Layouts/{@type}.html'
### override default layout path ###
'Neos.Form:Base':
renderingOptions:
layoutPathPattern: 'resource://Neos.FormExample/Private/CustomElements/Layouts/{@type}.html'
.. tip:: You can use **placeholders** in ``templatePathPattern``, ``partialPathPattern`` and ``layoutPathPattern``:
``{@package}`` will be replaced by the package key and ``{@type}`` by the current form element type
Expand All @@ -402,7 +402,7 @@ two radio buttons for ``Female`` and ``Male``. That's just a matter of a few lin

.. code-block:: yaml
TYPO3:
Neos:
Form:
presets:
########### CUSTOM PRESETS ###########
Expand Down
14 changes: 7 additions & 7 deletions Documentation/configuring-form-builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Let's say you have created your form element, and want to make it available insi

.. code-block:: yaml
# we are now inside TYPO3:Form:presets:[presetName]
# we are now inside Neos:Form:presets:[presetName]
formElementTypes:
'Your.Package:YourFormElement':
# the definitions for your form element
Expand All @@ -35,7 +35,7 @@ All form element groups are defined inside ``formElementGroups`` inside the pres

.. code-block:: yaml
# we are now inside TYPO3:Form:presets:[presetName]
# we are now inside Neos:Form:presets:[presetName]
formElementGroups:
specialCustom:
sorting: 500
Expand All @@ -54,7 +54,7 @@ Here follows the full configuration for the ``ProgrammingLanguageSelect`` (which

.. code-block:: yaml
# we are now inside TYPO3:Form:presets:[presetName]
# we are now inside Neos:Form:presets:[presetName]
formElementTypes:
'Neos.FormExample:ProgrammingLanguageSelect':
superTypes:
Expand Down Expand Up @@ -100,7 +100,7 @@ Choosing which strategy to use depends mostly on the expected usage patterns:

.. code-block:: yaml
# we are now inside TYPO3:Form:presets:[presetName]
# we are now inside Neos:Form:presets:[presetName]
formElementTypes:
'Neos.FormExample:GenderSelect':
formBuilder:
Expand All @@ -123,14 +123,14 @@ This can be configured as follows:

.. code-block:: yaml
# we are now inside TYPO3:Form:presets:[presetName]
# we are now inside Neos:Form:presets:[presetName]
formElementTypes:
'Neos.Form:TextMixin': # or any other type here
formBuilder:
editors:
validation:
availableValidators:
'TYPO3.Flow:StringLength': # or any other validator
'Neos.Flow:StringLength': # or any other validator
# mark this validator required such that it is always shown.
required: true
Expand All @@ -141,7 +141,7 @@ The same works for Finishers, for example the following configuration makes the

.. code-block:: yaml
# we are now inside TYPO3:Form:presets:[presetName]
# we are now inside Neos:Form:presets:[presetName]
formElementTypes:
'Neos.Form:Form':
formBuilder:
Expand Down
10 changes: 5 additions & 5 deletions Documentation/configuring-form-yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ configuration is stored. This is done in ``Settings.yaml``:

.. code-block:: yaml
TYPO3:
Neos:
Form:
yamlPersistenceManager:
savePath: 'resource://AcmeCom.SomePackage/Private/Form/'
Expand Down Expand Up @@ -63,20 +63,20 @@ The following YAML is stored as ``contact.yaml``:
identifier: name
label: 'Name'
validators:
- identifier: 'TYPO3.Flow:NotEmpty'
- identifier: 'Neos.Flow:NotEmpty'
-
type: 'Neos.Form:SingleLineText'
identifier: email
label: 'Email'
validators:
- identifier: 'TYPO3.Flow:NotEmpty'
- identifier: 'TYPO3.Flow:EmailAddress'
- identifier: 'Neos.Flow:NotEmpty'
- identifier: 'Neos.Flow:EmailAddress'
-
type: 'Neos.Form:MultiLineText'
identifier: message
label: 'Message'
validators:
- identifier: 'TYPO3.Flow:NotEmpty'
- identifier: 'Neos.Flow:NotEmpty'
finishers:
-
identifier: 'Neos.Form:Email'
Expand Down
4 changes: 2 additions & 2 deletions Documentation/extending-form-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ For this create a new PHP class at ``Your.Package/Classes/FormElements/Condition
if ($triggerValue === NULL || $triggerValue === '') {
return;
}
$this->addValidator(new \TYPO3\Flow\Validation\Validator\NotEmptyValidator());
$this->addValidator(new \Neos\Flow\Validation\Validator\NotEmptyValidator());
}
}

Expand All @@ -106,7 +106,7 @@ In order to use the new Form Element type you first have to extend the Form Defi

.. code-block:: yaml
TYPO3:
Neos:
Form:
presets:
somePreset:
Expand Down
34 changes: 17 additions & 17 deletions Documentation/extending-form-builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Let's say you want to adjust the form builder with a custom CSS file inside ``Yo

.. code-block:: yaml
TYPO3:
Neos:
FormBuilder:
stylesheets:
customAdjustments:
Expand Down Expand Up @@ -50,18 +50,18 @@ The default template is located inside ``Neos.FormBuilder/Resources/Private/Form

<h1>Form Builder - {{Neos.FormBuilder.Model.Form.formDefinition.label}}</h1>
{{#if Neos.FormBuilder.Model.Form.currentlyLoadingPreview}}
<span id="typo3-formbuilder-loading">Loading..</span>
<span id="neos-formbuilder-loading">Loading..</span>
{{/if}}

<ul id="typo3-formbuilder-toolbar">
<li class="typo3-formbuilder-preset">
<ul id="neos-formbuilder-toolbar">
<li class="neos-formbuilder-preset">
{{view Neos.FormBuilder.View.Header.PresetSelector}}
</li>
<li class="typo3-formbuilder-preview">
{{#view Neos.FormBuilder.View.Header.PreviewButton class="typo3-formbuilder-button icon"}}Preview{{/view}}
<li class="neos-formbuilder-preview">
{{#view Neos.FormBuilder.View.Header.PreviewButton class="neos-formbuilder-button icon"}}Preview{{/view}}
</li>
<li class="typo3-formbuilder-save">
{{#view Neos.FormBuilder.View.Header.SaveButton class="typo3-formbuilder-button icon"}}Save{{/view}}
<li class="neos-formbuilder-save">
{{#view Neos.FormBuilder.View.Header.SaveButton class="neos-formbuilder-button icon"}}Save{{/view}}
</li>
</ul>

Expand All @@ -75,7 +75,7 @@ Then, we need to tell the form builder that we want to use a different handlebar

.. code-block:: yaml
TYPO3:
Neos:
FormBuilder:
handlebarsTemplates:
Header: resource://Your.Package/Private/FormBuilderTemplates/Header.html
Expand All @@ -91,7 +91,7 @@ All editors for a given form element are defined inside the ``formElementTypes``

.. code-block:: yaml
# we are now inside TYPO3:Form:presets:[presetName]:formElementTypes
# we are now inside Neos:Form:presets:[presetName]:formElementTypes
'Neos.Form:TextMixin':
formBuilder:
editors:
Expand Down Expand Up @@ -122,9 +122,9 @@ Then, we will create a basic handlebars template and register it underneath ``El

.. code-block:: html

<div class="typo3-formbuilder-controlGroup">
<div class="neos-formbuilder-controlGroup">
<label>{{label}}:</label>
<div class="typo3-formbuilder-controls">
<div class="neos-formbuilder-controls">
[select should come here]
</div>
</div>
Expand All @@ -135,7 +135,7 @@ Now that we have all the pieces ready, let's actually use the editor inside the

.. code-block:: yaml
# we are now inside TYPO3:Form:presets:[presetName]:formElementTypes
# we are now inside Neos:Form:presets:[presetName]:formElementTypes
'Neos.Form:FileUpload':
formBuilder:
editors:
Expand Down Expand Up @@ -228,7 +228,7 @@ You need to do three things:

.. code-block:: yaml
TYPO3:
Neos:
Form:
presets:
yourPresetName: # fill in your preset name here, or "default"
Expand Down Expand Up @@ -260,12 +260,12 @@ Now, you only need to include the appropriate Handlebars template, which could l
{{label}}
{{#view Ember.Button target="parentView" action="remove"
isVisibleBinding="notRequired"
class="typo3-formbuilder-removeButton"}}Remove{{/view}}
class="neos-formbuilder-removeButton"}}Remove{{/view}}
</h4>

<div class="typo3-formbuilder-controlGroup">
<div class="neos-formbuilder-controlGroup">
<label>Database Table</label>
<div class="typo3-formbuilder-controls">
<div class="neos-formbuilder-controls">
{{view Ember.TextField valueBinding="currentCollectionElement.options.databaseTable"}}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It includes the following features:
* highly **flexible rendering** of form elements, based on Fluid
* **Extensible** with new form elements
* robust, **object oriented API**
* great integration into **TYPO3 Flow**
* great integration into **Neos Flow**

Furthermore, we built a **Form Builder** which is a web application for graphically
assembling and modifying forms, displayed below:
Expand Down
26 changes: 13 additions & 13 deletions Documentation/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ If you want to build a form with PHP, the skeleton for building a form looks as

namespace Your\Package;

use TYPO3\Flow\Annotations as Flow;
use Neos\Flow\Annotations as Flow;
use Neos\Form\Core\Model\FormDefinition;

class QuickstartFactory extends \Neos\Form\Factory\AbstractFormFactory {
Expand Down Expand Up @@ -137,15 +137,15 @@ Validation
----------

Every :api-core-model:`FormElement <AbstractFormElement>` implements the :api-core-model:`FormElementInterface`
which provides a convenient way to work with TYPO3 Flow validators::
which provides a convenient way to work with Neos Flow validators::

$name->addValidator(new \TYPO3\Flow\Validation\Validator\NotEmptyValidator());
$name->addValidator(new \Neos\Flow\Validation\Validator\NotEmptyValidator());

$email->addValidator(new \TYPO3\Flow\Validation\Validator\NotEmptyValidator());
$email->addValidator(new \TYPO3\Flow\Validation\Validator\EmailAddressValidator());
$email->addValidator(new \Neos\Flow\Validation\Validator\NotEmptyValidator());
$email->addValidator(new \Neos\Flow\Validation\Validator\EmailAddressValidator());

$comments->addValidator(new \TYPO3\Flow\Validation\Validator\NotEmptyValidator());
$comments->addValidator(new \TYPO3\Flow\Validation\Validator\StringLengthValidator(array('minimum' => 3)));
$comments->addValidator(new \Neos\Flow\Validation\Validator\NotEmptyValidator());
$comments->addValidator(new \Neos\Flow\Validation\Validator\StringLengthValidator(array('minimum' => 3)));

With the ``addValidator($validator)`` method you can attach one or more validators to a form element.
If you save the changes and reload the page where you embedded the form, you can see that
Expand Down Expand Up @@ -199,7 +199,7 @@ That's it for the quickstart. The complete code of your form factory should look

namespace Your\Package;

use TYPO3\Flow\Annotations as Flow;
use Neos\Flow\Annotations as Flow;
use Neos\Form\Core\Model\FormDefinition;

/**
Expand All @@ -220,17 +220,17 @@ That's it for the quickstart. The complete code of your form factory should look

$name = $page1->createElement('name', 'Neos.Form:SingleLineText');
$name->setLabel('Name');
$name->addValidator(new \TYPO3\Flow\Validation\Validator\NotEmptyValidator());
$name->addValidator(new \Neos\Flow\Validation\Validator\NotEmptyValidator());

$email = $page1->createElement('email', 'Neos.Form:SingleLineText');
$email->setLabel('Email');
$email->addValidator(new \TYPO3\Flow\Validation\Validator\NotEmptyValidator());
$email->addValidator(new \TYPO3\Flow\Validation\Validator\EmailAddressValidator());
$email->addValidator(new \Neos\Flow\Validation\Validator\NotEmptyValidator());
$email->addValidator(new \Neos\Flow\Validation\Validator\EmailAddressValidator());

$comments = $page1->createElement('message', 'Neos.Form:MultiLineText');
$comments->setLabel('Message');
$comments->addValidator(new \TYPO3\Flow\Validation\Validator\NotEmptyValidator());
$comments->addValidator(new \TYPO3\Flow\Validation\Validator\StringLengthValidator(array('minimum' => 3)));
$comments->addValidator(new \Neos\Flow\Validation\Validator\NotEmptyValidator());
$comments->addValidator(new \Neos\Flow\Validation\Validator\StringLengthValidator(array('minimum' => 3)));

$emailFinisher = new \Neos\Form\Finishers\EmailFinisher();
$emailFinisher->setOptions(array(
Expand Down

0 comments on commit 9d8a5b7

Please sign in to comment.