+
TYPO3 EXT:form
for developers
TRITUM GmbH / Björn Jacob / tritum
2
+
TRITUM
• First official TYPO3 “Professional
Development Agency” in Germany
• www.tritum.de
3
+
Björn Jacob
• CTO TRITUM GmbH
• Team lead EXT:form
• www.geocouch.de
+
Runtime manipulation
5
+
Basics
• all form elements run through life cycle
• can be accessed via hooks
• using hooks can often avoid creating new form elements 
instead change the behaviour of existing ones programmatically
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#hooks
6
+
Top hooks
• initializeFormElement
• afterBuildingFinished
• afterInitializeCurrentPage
• afterSubmit
• beforeRendering
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#hooks
7
+
Top hooks: initializeFormElement
• available…
• during the creation of the form
• before validation
• before submitted data is mapped to form elements
• at this stage not all of form elements are known
• example: prefill a „SingleSelect“ form element with values from
DB table
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#hooks
8
+
Top hooks: afterBuildingFinished
• available…
• as soon as the form is created
• before validation
• before submitted data is mapped to form elements
• at this stage all of form elements are known
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#hooks
9
+
Top hooks: afterInitializeCurrentPage
• available…
• after the form is created
• after the correct page is loaded (based on the REQUEST)
• a different page can be loaded, e.g. based on submitted data
• at this stage all submitted data is known but not validated
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#hooks
10
+
Top hooks: afterSubmit
• available…
• after the form is created
• after the correct page is known
• for each form element on this page the hook is fired
• at this stage all submitted data is known but not validated
• example: add dynamic validation to a form element based on the
submitted value of another form element
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#hooks
11
+
Top hooks: beforeRendering
• available for each form element before ist template is rendered
• at this stage all submitted data is known and validated
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#hooks
+
Own finisher
13
+
Basics
• finisher implementation…
• has to be registered via configuration key „implementationClassName“
• has to be programmed to the interface
TYPO3CMSFormDomainFinishersFinisherInterface
• should extend the class
TYPO3CMSFormDomainFinishersAbstractFinisher
• your logic should start with the method „executeInternal()“
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/Concepts/Index.html#custom-finisher-implementations
14
+
Example
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/Concepts/Index.html#custom-finisher-implementations
TYPO3:
CMS:
Form:
prototypes:
standard:
finishersDefinition:
CustomFinisher:
implementationClassName: ‘ACMEThemeDomainFinishersCustomFinisher'
options:
yourCustomOption: 'CertiFUNcation {text-1}'
15
+
Accessing options
• access your finisher options:
$this->parseOption('yourCustomOption‘);
• powerful weapon ;)
• access form values
• access values of previous finishers
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/Concepts/Index.html#accessing-finisher-options
+
Create and insert
a form via API
17
+
RenderViewHelper // Basics
RenderViewHelper is your starting point  include your forms in
any fluid template:
• <formvh:render
persistenceIdentifier="EXT:theme/Resources/Private/Forms/Form.yaml" />
• <formvh:render persistenceIdentifier="{settings.persistenceIdentifier}" />
• <formvh:render
factoryClass="ACMEThemeDomainFactoryCustomFormFactory" />
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#build-forms-programmatically
18
+
RenderViewHelper // FLUIDTEMPLATE
tt_content.custom_content_element = COA_INT
tt_content.custom_content_element {
10 = FLUIDTEMPLATE
10 {
file = EXT:theme/Resources/Private/Templates/CustomContentElement.html
settings {
persistenceIdentifier =
EXT:theme/Resources/Private/Forms/CustomContentElement.yaml
}
extbase.pluginName = Form
extbase.controllerExtensionName = Formframework
extbase.controllerName = FormFrontend
extbase.controllerActionName = perform
}
}
19
+
RenderViewHelper // FLUIDTEMPLATE
EXT:theme/…/CustomContentElement.html:
• <formvh:render persistenceIdentifier="{settings.persistenceIdentifier}" />
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#build-forms-programmatically
20
+
RenderViewHelper // Basics
create PHP file/ class and include it in your custom template:
• <formvh:render
factoryClass="ACMEThemeDomainFactoryCustomFormFactory" />
https://docs.typo3.org/typo3cms/drafts/code.tritum.de/TYPO3.CMS/Form_Documentation/ApiReference/Index.html#build-forms-programmatically
+
More?
22
+
API allows more
• create your own…
• form elements
• validators
• renderer
• JS view
+
What‘s next?
24
+
2017
• finish documentation
• release examples/ snippet DB
• powermail migration
25
+
TYPO3 v9 (tbd)
• translations via backend
• additional finishers in editor
• HTML5 elements and validators
• streamline configuration system
+
Thanks! Questions?
TRITUM GmbH / Björn Jacob / tritum

TYPO3 EXT:form for developers