JSON type

The extension provides a custom type to persist arbitrary form values as JSON data to the database. This allows to dynamically persist values in a relatively easy and maintainable way, since the provided type implements TYPO3 core API. The resulting values are actually JSON-encoded strings.

class JsonType
Fully qualified name
\EliasHaeussler\Typo3FormConsent\Type\JsonType

Type implementing TYPO3's \TYPO3\CMS\Core\Type\TypeInterface that accepts and stores JSON-encoded strings.

static fromArray ( $data)

Create a new JSON type from the given array.

param array $data

Array to persist, will be JSON-encoded

returntype

EliasHaeussler\Typo3FormConsent\Type\JsonType

toArray ( )

Return current JSON-encoded string as parsed array.

returntype

array

Type transformers

Type transformers describe a way how specific data can be modified so that persistence of its value into the database is assured. All returned types are JSON types.

interface TypeTransformer
Fully qualified name
\EliasHaeussler\Typo3FormConsent\Type\Transformer\TypeTransformer

Interface used to transform a given value to a persistable JSON type.

transform ( $formRuntime)

Transform a specific form value from the given form runtime to a persistable JSON type.

param TYPO3\CMS\Form\Domain\Runtime\FormRuntime $formRuntime

Form runtime from which to extract values

returntype

EliasHaeussler\Typo3FormConsent\Type\JsonType

The extension ships with two type transformers:

  • \EliasHaeussler\Typo3FormConsent\Type\Transformer\FormRequestTypeTransformer: Used to transform the current form request parameters to JSON type in order to allow resubmission of the given form
  • \EliasHaeussler\Typo3FormConsent\Type\Transformer\FormValuesTypeTransformer: Used to transform all submitted form values to JSON type in order to store them next to the generated form consent