b13/otf

Provides on-the-fly evaluation hints for FormEngine

Installs: 371

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 8

Forks: 0

Open Issues: 0

Type:typo3-cms-extension

0.1.2 2021-11-23 09:48 UTC

This package is auto-updated.

Last update: 2024-11-29 06:41:34 UTC


README

This TYPO3 extension allows to add a FormEngine FieldWizard to specific TCA fields. The FieldWizard checks the corresponding fields for their eval configuration. If one or multiple supported evaluations are found, the FieldWizard displays on-the-fly evaluation hints in the backend form.

An example use case is the username field of fe_users, which is configured as unqiueInPid and would therefore add a hint, as soon as an already existing username is entered.

Installation

Install this extension via composer req b13/otf.

You can also download the extension from the TYPO3 Extension Repository and activate it in the Extension Manager of your TYPO3 installation.

Note: This extension is compatible with TYPO3 v10 and v11.

Configuration

The FieldWizard can be added to any TCA field of type input.

The following example adds the FieldWizard to the username and email fields of the TYPO3 fe_users table.

<?php

defined('TYPO3') or die();

\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Otf\Tca\Registry::class)
    ->registerFields(
        new \B13\Otf\Tca\Configuration('fe_users',
            new \B13\Otf\Tca\Field('username'),
            new \B13\Otf\Tca\Field('email')
        )
    );

In case you want to add the FieldWizard to a field, which does not yet define any supported evaluation, you can simply add new evaluations to the Field.

<?php

defined('TYPO3') or die();

\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Otf\Tca\Registry::class)
    ->registerFields(
        new \B13\Otf\Tca\Configuration('fe_users',
            (new \B13\Otf\Tca\Field('email'))->addEvaluations('uniqueInPid', 'email')
        )
    );

It's also possible to remove existing evaluations with the ->removeEvaluations() method.

The above examples are for the use in TCA/Overrides files. In your own TCA, simply add the FieldWizard to your field's configuration directly:

'aField' => [
    'label' => 'aField',
    'config' => [
        'type' => 'input',
        'eval' => 'trim,required,unique',
        'fieldWizard' => [
            'otfWizard' => [
                'renderType' => 'otfWizard'
            ]
        ]
    ]
]

Supported evaluations

Currently, following evaluations are supported:

  • unique
  • uniqueInPid
  • email

Administration

The behaviour of the on-the-fly evaluation hints can be configured with User TSconfig. Following options are available:

  • tx_otf.conflictingRecordLink - Whether a link to the confliciting record should be displayed (Default: 1)

Registration API

You can register your own evaluation services to handle additional evals. Therefore, create a new evaluation service class which implements the EvaluationInterface. The class will then automatically be tagged and registered. Additionally, you can extend AbstractEvaluation, which already implements some required methods.

Credits

This extension was created by Oliver Bartsch in 2021 for b13 GmbH, Stuttgart.

Find more TYPO3 extensions we have developed that help us deliver value in client projects. As part of the way we work, we focus on testing and best practices to ensure long-term performance, reliability, and results in all our code.