Extendability

Use your own flavor of fields

Since version 8.8.0 its easier then ever to user your own fields. Just add your partial folder via typoscript and register your own field configuration. After that you need to tell the user ts config that the new type is available to be selected in the plugin too.

Fields.typoscript:

plugin.tx_sfregister.view.partialRootPaths.50 = EXT:your_extension/Resources/Private/Partials/
plugin.tx_sfregister.settings.fields.configuration {
   your_field_key {
      partial = YourFieldKey
      backendLabel = LLL:EXT:your_extension/Resources/Private/Language/locallang_be.xlf:your_field_key
   }
}

ext_localconf.php:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(
'@import \'EXT:sf_register/Configuration/TypoScript/Fields.typoscript\''
);

TypoScript Setup:

@import 'EXT:sf_register/Configuration/TypoScript/Fields.typoscript'

By using the same fields file both in typoscript as well as in user ts config. No additional configuration is needed.

In your partials there are the following information available

  • {user} the user object with previous entered values
  • {fieldName} the name of the field in the user object
  • {options} every value that is inside of the field config {partial, backendLabel, etc}
  • {settings} the general plugin settings

Adding custom properties

Since late the frontend user domain model can be extended. This can be done the extension ‘extender’ which sole purpose is to extend extbase domain models. There is an example on how to use the extender.

If you run into problems extending please be aware that the only solution supported is by the use of ‘extender’.

In this example its noteworthy that the last array key is not required but adviced.

The path to the file matches extension key and extbase compatible path to the domain model.

For highlighting purpose its adviced to let the domain model extend from \Evoweb\SfRegister\Domain\Model\FrontendUser

ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sf_register']['extender'][\Evoweb\SfRegister\Domain\Model\FrontendUser::class]['cem_sitepackage'] = 'EXT:cem_sitepackage/Classes/Domain/Model/FrontendUser.php';

Beside extending the domain model with property and get-/set-method a field needs to be created for sql and registered in TCA.

ext_tables.sql:

#
# Table structure for table 'fe_users'
#
CREATE TABLE fe_users (
        extending varchar(60) DEFAULT '',
);

TCA/Overrides/fe_users.php:

$temporaryColumns = array(
        'extending' => array(
                'exclude' => 1,
                'label' => 'extending',
                'config' => array(
                        'type' => 'input',
                        'readOnly' => TRUE,
                )
        ),
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $temporaryColumns, 1);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('fe_users', 'extending');

Bring in your own captcha

By implementing a adapter which is extending the \Evoweb\SfRegister\Services\Captcha\AbstractAdapter you are able to add an own captcha. The adapter now then has to be configured to be usable by adding typoscript settings like the following taken from recaptcha:

Captcha.typoscript:

plugin.tx_sfregister.settings {
   # register recaptcha as captcha possibility
   captcha.recaptcha = Evoweb\Recaptcha\Adapter\SfRegisterAdapter

   fields {
      configuration {
         # change captcha field type to recaptcha
         captcha.type = Recaptcha
      }
   }

   validation.create {
      # tell validation to use recaptcha adapter
      captcha = Evoweb\SfRegister\Validation\Validator\CaptchaValidator(type = recaptcha)
   }
}

PSR-14 Events

This kind of event is superseding Hooks and Signal-Slots in TYPO3 and are the way to go. That’s why all signals are replaced with their event counterparts.

How to implement a slot

An overview on how to configure and interact with events was given on the Developer Days in 2019. The detailed example shows how to configure them in the Services.yaml:

Services.yaml:

Evoweb\SfRegister\EventListener\FeuserControllerListener:
  tags:
    - name: event.listener
      identifier: 'sfregister_feusercontroller_processinitializeaction'
      method: 'onProcessInitializeActionEvent'
      event: Evoweb\SfRegister\Controller\Event\ProcessInitializeActionEvent

The code above shows how to get an event listener is registered to an event.

Available events

Event Parameter
Evoweb\SfRegister\Controller\Event\InitializeActionEvent FeuserController, array
FeuserCreateController Evoweb\SfRegister\Controller\Event\CreateFormEvent Evoweb\SfRegister\Controller\Event\CreatePreviewEvent Evoweb\SfRegister\Controller\Event\CreateSaveEvent Evoweb\SfRegister\Controller\Event\CreateConfirmEvent Evoweb\SfRegister\Controller\Event\CreateRefuseEvent Evoweb\SfRegister\Controller\Event\CreateAcceptEvent Evoweb\SfRegister\Controller\Event\CreateDeclineEvent Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array
FeuserDeleteController Evoweb\SfRegister\Controller\Event\DeleteFormEvent Evoweb\SfRegister\Controller\Event\DeleteSaveEvent Evoweb\SfRegister\Controller\Event\DeleteConfirmEvent Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array
FeuserEditController Evoweb\SfRegister\Controller\Event\EditFormEvent Evoweb\SfRegister\Controller\Event\EditPreviewEvent Evoweb\SfRegister\Controller\Event\EditSaveEvent Evoweb\SfRegister\Controller\Event\EditConfirmEvent Evoweb\SfRegister\Controller\Event\EditAcceptEvent Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array
FeuserInviteController Evoweb\SfRegister\Controller\Event\InviteFormEvent Evoweb\SfRegister\Controller\Event\InviteInviteEvent Evoweb\SfRegister\Domain\Model\FrontendUser, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, bool
FeuserPasswordController Evoweb\SfRegister\Controller\Event\PasswordFormEvent Evoweb\SfRegister\Controller\Event\PasswordSaveEvent array Evoweb\SfRegister\Domain\Model\FrontendUser, array
FeuserResendController Evoweb\SfRegister\Controller\Event\ResendFormEvent Evoweb\SfRegister\Controller\Event\ResendMailEvent Evoweb\SfRegister\Domain\Model\Email, array Evoweb\SfRegister\Domain\Model\Email, array
Evoweb\SfRegister\Services\Event\NotifyAdminCreateAcceptEvent Evoweb\SfRegister\Services\Event\NotifyAdminCreateConfirmEvent Evoweb\SfRegister\Services\Event\NotifyAdminCreateDeclineEvent Evoweb\SfRegister\Services\Event\NotifyAdminCreateRefuseEvent Evoweb\SfRegister\Services\Event\NotifyAdminCreateSaveEvent Evoweb\SfRegister\Services\Event\NotifyAdminDeleteConfirmEvent Evoweb\SfRegister\Services\Event\NotifyAdminDeleteSaveEvent Evoweb\SfRegister\Services\Event\NotifyAdminEditAcceptEvent Evoweb\SfRegister\Services\Event\NotifyAdminEditConfirmEvent Evoweb\SfRegister\Services\Event\NotifyAdminEditSaveEvent Evoweb\SfRegister\Services\Event\NotifyAdminInviteInviteEvent Evoweb\SfRegister\Services\Event\NotifyAdminResendMailEvent Evoweb\SfRegister\Services\Event\NotifyUserCreateAcceptEvent Evoweb\SfRegister\Services\Event\NotifyUserCreateConfirmEvent Evoweb\SfRegister\Services\Event\NotifyUserCreateDeclineEvent Evoweb\SfRegister\Services\Event\NotifyUserCreateRefuseEvent Evoweb\SfRegister\Services\Event\NotifyUserCreateSaveEvent Evoweb\SfRegister\Services\Event\NotifyUserDeleteConfirmEvent Evoweb\SfRegister\Services\Event\NotifyUserDeleteSaveEvent Evoweb\SfRegister\Services\Event\NotifyUserEditAcceptEvent Evoweb\SfRegister\Services\Event\NotifyUserEditConfirmEvent Evoweb\SfRegister\Services\Event\NotifyUserEditSaveEvent Evoweb\SfRegister\Services\Event\NotifyUserInviteInviteEvent Evoweb\SfRegister\Services\Event\NotifyUserResendMailEvent Evoweb\SfRegister\Services\Event\InvitationToRegisterEvent Evoweb\SfRegister\Services\Event\PreSubmitMailEvent Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array Evoweb\SfRegister\Domain\Model\FrontendUser, array, array TYPO3\CMS\Core\Mail\MailMessage, array, array