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 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.

Parameters
  • $data (array) -- Array to persist, will be JSON-encoded

Return type

EliasHaeussler\Typo3FormConsent\Type\JsonType

toArray()

Return current JSON-encoded string as parsed array.

Return type

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 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.

Parameters
  • $formRuntime (TYPO3\CMS\Form\Domain\Runtime\FormRuntime) -- Form runtime from which to extract values

Return type

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