Download the PHP package heimrichhannot/contao-form-type-bundle without Composer

On this page you can find all versions of the php package heimrichhannot/contao-form-type-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package contao-form-type-bundle

Form Type Bundle

Form type bundle is an extension for the Contao CMS to provide a generic way to create forms for specific approaches with contao form generator. It is aimed at developers and contains no build-in form types.

Feature

Installation

Install the bundle via composer and update your database afterwards:

Usage

Create a new form type

Create a new class that extends AbstractFormType. Register it as service with autoconfiguration enabled.

A label can be set within $GLOBALS['TL_LANG']['tl_form']['FORMTYPE']:

First time wizard

You can add a first time wizard to your form type by implementing getDefaultFields() method. It expects field definitions in array format as return values. These fields will be created when executing the wizard.

Form events

You can register event listeners for events during form livecycle. These events are mappings of the corresponding contao form hooks but will only fire for the specific form type.

Following events are available:

Event Name
CompileFormFieldsEvent huh.form_type.[TYPE].compile_form_fields
LoadFormFieldEvent huh.form_type.[TYPE].load_form_field
PrepareFormDataEvent huh.form_type.[TYPE].prepare_form_data
ProcessFormDataEvent huh.form_type.[TYPE].process_form_data
StoreFormDataEvent huh.form_type.[TYPE].store_form_data
ValidateFormFieldEvent huh.form_type.[TYPE].validate_form_field

Options event

If you want to provide options for a select, checkbox or radio form field, you can register an event listener. The event name is huh.form_type.<formtype>.<field>.options'.

Unified Dispatcher for Field Options

Use FieldOptionsDispatcherTrait to dispatch FieldOptionsEvent huh.form_type.<formtype>.<field>.options and Contao fields.<field>.options callbacks alike.

Example:

Form Context

Implementing a form context evaluator on your from type allows you to change the form's behavior depending on the context it is used in. This can be used e.g. to load existing data into the form fields, perhaps to create an editing form.

Built-in Form Edit Context

A basic default form context evaluator providing editing functionality is built into the bundle. Just override DEFAULT_FORM_CONTEXT_TABLE in your form type to allow editing the respective database model:

If no DEFAULT_FORM_CONTEXT_TABLE is set, the form will be treated as a creation form by default.

Create your own Form Context

To implement your own form context evaluator, override evaluateFormContext() in your form type:

The example shows the implementation of a form context evaluator that allows editing a database model with a primary key given by the query parameter edit.

To retrieve the current form context, call the getter on your form type:

We do not recommend to call $this->evaluateFormContext() directly, as it will skip future cache implementations if you do.

Form Context Actions

Most commonly used form context actions are already implemented.

FormContextAction::INVALID can be used to indicate that the form should not be processed.

To instantiate a FormContext object with a built-in action, use the static factory methods:

Alternatively, you may also use the FormContext constructor:

However, you may also specify your own actions when constructing a FormContext object, or by overriding the action of an existing object.

This way you are not bound to the built-in actions.


All versions of contao-form-type-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
contao/core-bundle Version ^4.13 || ^5.0.8
symfony/event-dispatcher-contracts Version ^1.0 || ^2.0 || ^3.0
symfony/translation-contracts Version ^1.0 || ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package heimrichhannot/contao-form-type-bundle contains the following files

Loading the files please wait ....