Handlebars Forms 

Extension key

handlebars_forms

Package name

cpsit/typo3-handlebars-forms

Version

main

Language

en

Author

coding. powerful. systems. CPS GmbH

License

This extension documentation is published under the CC BY-NC-SA 4.0 (Creative Commons) license.


An extension for TYPO3 CMS that provides form rendering with Handlebars, based on the EXT:handlebars extension. It is designed to provide rendering options for all default form elements shipped by EXT:form, while rendering for custom form elements can be easily configured using dedicated interface implementations.


Introduction 

A quick overview about the main features provided by this extension.

Installation 

Instructions on how to install this extension, and which TYPO3 and PHP versions are currently supported.

Configuration 

Learn how to configure the extension in various ways. This includes site configuration and TypoScript configuration.

Usage 

This section describes how to use this extension in various ways.

Developer corner 

A quick overview about all relevant classes provided by this extension.

Migration 

Required migration steps when upgrading the extension to a new major version.

Introduction 

What does it do? 

The extension provides a way to render forms built with the TYPO3 Form Framework. It allows rendering of generic forms, defined by a comprehensive TypoScript rendering definition. This definition can be extended to a specific form to allow customizating the output of various forms. In addition, the extension allows to modify the build mechanisms of so called view models, which makes the whole concept very danymic and flexible.

Features 

  • Support for all default form elements
  • Ability to define generic form rendering definitions
  • Possibility to override form rendering for specific form definitions
  • Easy to extend and customize for custom form elements
  • Compatible with TYPO3 13.4 LTS

Support 

There are several ways to get support for this extension:

License 

This extension is licensed under GNU General Public License 2.0 (or later).

Installation 

Requirements 

  • PHP 8.2 - 8.5
  • TYPO3 13.4 LTS

Installation 

Require the extension via Composer (recommended):

composer require cpsit/typo3-handlebars-forms
Copied!

Or download it from the TYPO3 extension repository.

Configuration 

tba.

Usage 

tba.

Supported renderables 

AdvancedPassword 

(a) ViewModelCollection

Contains view models, reflecting both password fields:

Name Type Description
passwordField ViewHelperContainedViewModel Contains result from <formvh:form.password> view helper invocation for password field.
confirmationField (a) ViewHelperContainedViewModel Result from <formvh:form.password> view helper invocation for password confirmation field.
(b) FormFieldViewModel Combination of confirmation label and result from <formvh:form.password> view helper invocation for password confirmation field.

Checkbox 

(a) ViewHelperContainedViewModel
Contains result from <formvh:form.checkbox> view helper invocation.

ContentElement 

(a) ViewHelperContainedViewModel
Contains result from <f:cObject> view helper invocation.
(b) SimpleViewModel
If configured content element UID is invalid.

CountrySelect 

(a) ViewHelperContainedViewModel
Contains result from <formvh:form.countrySelect> view helper invocation.

DatePicker 

Fieldset 

(a) StandaloneTagViewModel
Contains the <fieldset> tag with class name(s) and additional attributes.

FileUpload, ImageUpload 

(a) ViewModelCollection

If uploaded resource can be resolved. Contains two or three view models:

Name Type Description
uploadField ViewHelperContainedViewModel Contains result from <formvh:form.uploadedResource> view helper invocation for password field.
resource FileResourceViewModel References file upload, which is an instance of FileReference or PseudoFileReference.
resourcePointerField StandaloneTagViewModel Optional. References hidden <input> field with resource pointer, if available.
(b) ViewHelperContainedViewModel
If uploaded resource cannot be resolved. Contains result from <formvh:form.uploadedResource> view helper invocation.

Form 

(a) ViewHelperContainedViewModel
Contains result from <formvh:form> view helper invocation.

Hidden 

(a) ViewHelperContainedViewModel
Contains result from <formvh:form.hidden> view helper invocation.

MultiCheckbox 

(a) ViewModelCollection

Contains view models which reflect all available options, each as one of:

Type Description
FormFieldViewModel If label is available. Contains a combination of label and result from <formvh:form.checkbox> view helper invocation.
ViewHelperContainedViewModel If associated label is invalid or missing. Contains result from <formvh:form.checkbox> view helper invocation.

Password 

(a) ViewHelperContainedViewModel
Contains result from <formvh:form.password> view helper invocation.

RadioButton 

(a) ViewModelCollection

Contains view models which reflect all available options, each as one of:

Type Description
FormFieldViewModel If label is available. Contains a combination of label and result from <formvh:form.radio> view helper invocation.
ViewHelperContainedViewModel If associated label is invalid or missing. Contains result from <formvh:form.radio> view helper invocation.

SingleSelect, MultiSelect 

(a) ViewHelperContainedViewModel
Contains result from <formvh:form.select> view helper invocation. Includes available <option> tags as children of type StandaloneTagViewModel.

StaticText 

(a) FormFieldViewModel
If label is available. Contains a combination of label and <p> tag.
(b) StandaloneTagViewModel
If label is invalid or missing. Contains <p> tag with class and text.

Textarea 

(a) ViewHelperContainedViewModel
Contains result from <formvh:form.textarea> view helper invocation.

Text, Date, Email, Number, Telephone, Url 

(a) ViewHelperContainedViewModel
Contains result from <formvh:form.textfield> view helper invocation.

Migration 

tba.

Contributing 

Thanks for considering contributing to this extension! Since it is an open source product, its successful further development depends largely on improving and optimizing it together.

The development of this extension follows the official TYPO3 coding standards. To ensure the stability and cleanliness of the code, various code quality tools are used and most components are covered with test cases. In addition, we use DDEV for local development. Make sure to set it up as described below. For continuous integration, we use GitHub Actions.

Create an issue first 

Before you start working on the extension, please create an issue on GitHub: https://github.com/CPS-IT/handlebars-forms/issues

Also, please check if there is already an issue on the topic you want to address.

Contribution workflow 

Preparation 

Clone the repository first:

git clone https://github.com/CPS-IT/handlebars-forms.git
cd handlebars-forms
Copied!

Now install all Composer dependencies:

composer install
Copied!

Analyze code 

# All analyzers
composer analyze

# Specific analyzers
composer analyze:dependencies
Copied!

Check code quality 

# All linters
composer lint

# Specific linters
composer lint:composer
composer lint:editorconfig
composer lint:php
composer lint:typoscript

# Fix all CGL issues
composer fix

# Fix specific CGL issues
composer fix:composer
composer fix:editorconfig
composer fix:php
composer fix:typoscript

# All static code analyzers
composer sca

# Specific static code analyzers
composer sca:php
Copied!

Run tests 

# All tests
composer test

# Specific tests
composer test:functional
composer test:unit

# All tests with code coverage
composer test:coverage

# Specific tests with code coverage
composer test:coverage:functional
composer test:coverage:unit

# Merge code coverage of all test suites
composer test:coverage:merge
Copied!

Code coverage reports are written to .Build/coverage. You can open the last merged HTML report like follows:

open .Build/coverage/html/_merged/index.html
Copied!

Build documentation 

# Rebuild and open documentation
composer docs

# Build documentation (from cache)
composer docs:build

# Open rendered documentation
composer docs:open
Copied!

The built docs will be stored in .Build/docs.

Pull Request 

Once you have finished your work, please submit a pull request and describe what you've done: https://github.com/CPS-IT/handlebars-forms/pulls

Ideally, your PR references an issue describing the problem you're trying to solve. All described code quality tools are automatically executed on each pull request for all currently supported PHP versions and TYPO3 versions.

Sitemap