As a developer, you will learn some useful technical features of EXT:form. Covered topics are: runtime manipulation using hooks, creating own finishers and PHP API usage.
5. 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
7. 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. 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. 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. 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. 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
13. 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
17. 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
20. 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