diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b1e0fda..8dd023c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,7 +15,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.3 coverage: none tools: composer:v2 env: @@ -29,9 +29,7 @@ jobs: strategy: matrix: php-version: - - 7.4 - - 8.0 - - 8.1 + - 8.3 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/Classes/Controller/FrontendUserController.php b/Classes/Controller/FrontendUserController.php index c8adc55..0dd7d60 100644 --- a/Classes/Controller/FrontendUserController.php +++ b/Classes/Controller/FrontendUserController.php @@ -3,15 +3,17 @@ namespace Visol\Newsletterregistration\Controller; use Psr\Http\Message\ResponseInterface; +use TYPO3\CMS\Core\Crypto\HashService; use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory; use TYPO3\CMS\Core\Crypto\Random; +use TYPO3\CMS\Core\Mail\MailMessage; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Http\ForwardResponse; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; -use Visol\Newsletterregistration\Domain\Repository\FrontendUserRepository; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use Visol\Newsletterregistration\Domain\Model\FrontendUser; +use Visol\Newsletterregistration\Domain\Repository\FrontendUserRepository; /** * This file is part of the TYPO3 CMS project. @@ -27,65 +29,65 @@ */ class FrontendUserController extends ActionController { + public function __construct( + protected FrontendUserRepository $frontendUserRepository, + protected PersistenceManager $persistenceManager, + ) { + } - /** - * @var FrontendUserRepository - */ - protected $frontendUserRepository; - - /** - * persistenceManager - * - * @var PersistenceManager - */ - protected $persistenceManager; - - /** - * @param FrontendUser|null $newFrontendUser - * @return ResponseInterface - */ - public function newAction(FrontendUser $newFrontendUser = null): ResponseInterface + public function newAction(?FrontendUser $newFrontendUser = null): ResponseInterface { $this->view->assign('newFrontendUser', $newFrontendUser); return $this->htmlResponse(); } - /** - * @param FrontendUser $newFrontendUser - */ - public function createAction(FrontendUser $newFrontendUser): void + public function createAction(FrontendUser $newFrontendUser): ResponseInterface { /** @var FrontendUser $existingFrontendUser */ - $existingFrontendUser = $this->frontendUserRepository->findOneByEmailAndStoragePageId($newFrontendUser->getEmail(), - (int)$this->settings['userFolder']); + $existingFrontendUser = $this->frontendUserRepository->findOneByEmailAndStoragePageId( + $newFrontendUser->getEmail(), + (int) $this->settings['userFolder'] + ); if ($existingFrontendUser instanceof FrontendUser) { - if ($existingFrontendUser->isDisable() === true) { + if ($existingFrontendUser->isDisable()) { // user is disabled, so maybe the opt-in failed - we send an opt-in-email again $url = $this->createOptInUri($existingFrontendUser->getUid()); - $optInUri = '' . $url . ''; - $emailContent = LocalizationUtility::translate('createFrontendUser.optInEmail.activate', + $optInUri = '' . $url . ''; + $emailContent = LocalizationUtility::translate( + 'createFrontendUser.optInEmail.activate', $this->request->getControllerExtensionName(), - [1 => $this->settings['newsletterTitle'], 2 => $optInUri]); + [1 => $this->settings['newsletterTitle'], 2 => $optInUri] + ); $this->sendEmail($existingFrontendUser->getEmail(), $this->settings['newsletterTitle'], $emailContent); - } else { + } elseif (!empty($this->settings['fieldList'])) { // user exists and is active - if (!empty($this->settings['fieldList'])) { - // user is editable, we send an edit profile link - $optInUri = $this->createOptInUri($existingFrontendUser->getUid(), 'edit'); - $emailContent = LocalizationUtility::translate('createFrontendUser.optInEmail.edit.unsubscribeOnly', - $this->request->getControllerExtensionName(), - [1 => $this->settings['newsletterTitle'], 2 => $optInUri]); - $this->sendEmail($existingFrontendUser->getEmail(), $this->settings['newsletterTitle'], - $emailContent); - } else { - // user is not editable, so we send an unsubscribe link - $optInUri = $this->createOptInUri($existingFrontendUser->getUid(), 'delete'); - $emailContent = LocalizationUtility::translate('createFrontendUser.optInEmail.edit.unsubscribeOnly', - $this->request->getControllerExtensionName(), - [1 => $this->settings['newsletterTitle'], 2 => $optInUri]); - $this->sendEmail($existingFrontendUser->getEmail(), $this->settings['newsletterTitle'], - $emailContent); - } + // user is editable, we send an edit profile link + $url = $this->createOptInUri($existingFrontendUser->getUid(), 'edit'); + $optInUri = '' . $url . ''; + $emailContent = LocalizationUtility::translate( + 'createFrontendUser.optInEmail.edit.unsubscribeOnly', + $this->request->getControllerExtensionName(), + [1 => $this->settings['newsletterTitle'], 2 => $optInUri] + ); + $this->sendEmail( + $existingFrontendUser->getEmail(), + $this->settings['newsletterTitle'], + $emailContent + ); + } else { + // user is not editable, so we send an unsubscribe link + $url = $this->createOptInUri($existingFrontendUser->getUid(), 'delete'); + $optInUri = '' . $url . ''; + $emailContent = LocalizationUtility::translate( + 'createFrontendUser.optInEmail.edit.unsubscribeOnly', + $this->request->getControllerExtensionName(), + [1 => $this->settings['newsletterTitle'], 2 => $optInUri] + ); + $this->sendEmail( + $existingFrontendUser->getEmail(), + $this->settings['newsletterTitle'], + $emailContent + ); } } else { $newFrontendUser->setUsername($newFrontendUser->getEmail()); @@ -93,18 +95,20 @@ public function createAction(FrontendUser $newFrontendUser): void $newFrontendUser->setActivateNewsletter(true); $newFrontendUser->setReceiveHtmlMail(true); $newFrontendUser->setDisable(true); - $newFrontendUser->setPid((int)$this->settings['userFolder']); + $newFrontendUser->setPid((int) $this->settings['userFolder']); $this->frontendUserRepository->add($newFrontendUser); $this->persistenceManager->persistAll(); $url = $this->createOptInUri($newFrontendUser->getUid()); - $optInUri = '' . $url . ''; - $emailContent = LocalizationUtility::translate('createFrontendUser.optInEmail.activate', + $optInUri = '' . $url . ''; + $emailContent = LocalizationUtility::translate( + 'createFrontendUser.optInEmail.activate', $this->request->getControllerExtensionName(), - [1 => $this->settings['newsletterTitle'], 2 => $optInUri]); + [1 => $this->settings['newsletterTitle'], 2 => $optInUri] + ); $this->sendEmail($newFrontendUser->getEmail(), $this->settings['newsletterTitle'], $emailContent); } - $this->redirect('pendingOptIn'); + return $this->redirect('pendingOptIn'); } /** @@ -115,34 +119,29 @@ public function pendingOptInAction(): ResponseInterface return $this->htmlResponse(); } - /** - * @param string $ruid - * @param string $verify - */ public function activateAction(string $ruid = '', string $verify = '') { - $frontendUserUid = (int)base64_decode($ruid); - if (!$frontendUserUid) { + $frontendUserUid = (int) base64_decode($ruid); + if ($frontendUserUid === 0) { return new ForwardResponse('invalidLink'); - } else { - if ($verify === GeneralUtility::hmac($frontendUserUid)) { - $frontendUser = $this->frontendUserRepository->findByUid($frontendUserUid, false); - if ($frontendUser instanceof FrontendUser) { - $frontendUser->setDisable(false); - $this->frontendUserRepository->update($frontendUser); - $this->persistenceManager->persistAll(); - $successMessage = LocalizationUtility::translate('activateFrontendUser.success', - $this->request->getControllerExtensionName(), - [1 => $this->settings['newsletterTitle']]); - $this->addFlashMessage($successMessage); - $this->redirect('edit', null, null, $this->request->getArguments()); - } else { - return new ForwardResponse('invalidLink'); - } - } else { - return new ForwardResponse('invalidLink'); + } + if ($verify === GeneralUtility::makeInstance(HashService::class)->hmac($frontendUserUid, 'changeMe')) { + $frontendUser = $this->frontendUserRepository->findByUid($frontendUserUid, false); + if ($frontendUser instanceof FrontendUser) { + $frontendUser->setDisable(false); + $this->frontendUserRepository->update($frontendUser); + $this->persistenceManager->persistAll(); + $successMessage = LocalizationUtility::translate( + 'activateFrontendUser.success', + $this->request->getControllerExtensionName(), + [1 => $this->settings['newsletterTitle']] + ); + $this->addFlashMessage($successMessage); + return $this->redirect('edit', null, null, $this->request->getArguments()); } + return new ForwardResponse('invalidLink'); } + return new ForwardResponse('invalidLink'); } /** @@ -153,54 +152,52 @@ public function invalidLinkAction(): ResponseInterface return $this->htmlResponse(); } - /** - * @param string $ruid - * @param string $verify - */ public function editAction(string $ruid = '', string $verify = ''): ResponseInterface { - $frontendUserUid = (int)base64_decode($ruid); - if (!$frontendUserUid) { + $frontendUserUid = (int) base64_decode($ruid); + if ($frontendUserUid === 0) { return new ForwardResponse('invalidLink'); - } else { - if ($verify === GeneralUtility::hmac($frontendUserUid)) { - $frontendUser = $this->frontendUserRepository->findByUid($frontendUserUid); - if ($frontendUser instanceof FrontendUser) { - $this->view->assign('frontendUser', $frontendUser); - $this->view->assign('unsubscribeUri', $this->createOptInUri($frontendUserUid, 'delete')); - $this->view->assign('verify', $verify); - if (!empty($this->settings['fieldList'])) { - // If fields need to be rendered, pass the names of the fields to the view - $this->view->assign('fieldsToRender', - GeneralUtility::trimExplode(',', $this->settings['fieldList'])); - } - } else { - return new ForwardResponse('invalidLink'); + } + if ($verify === GeneralUtility::makeInstance(HashService::class)->hmac($frontendUserUid, 'changeMe')) { + $frontendUser = $this->frontendUserRepository->findByUid($frontendUserUid); + if ($frontendUser instanceof FrontendUser) { + $this->view->assign('frontendUser', $frontendUser); + $this->view->assign('unsubscribeUri', $this->createOptInUri($frontendUserUid, 'delete')); + $this->view->assign('verify', $verify); + if (!empty($this->settings['fieldList'])) { + // If fields need to be rendered, pass the names of the fields to the view + $this->view->assign( + 'fieldsToRender', + GeneralUtility::trimExplode(',', $this->settings['fieldList']) + ); } } else { return new ForwardResponse('invalidLink'); } + } else { + return new ForwardResponse('invalidLink'); } return $this->htmlResponse(); } - /** - * @param FrontendUser $frontendUser - * @param string $verify - */ public function updateAction(FrontendUser $frontendUser, string $verify = ''): ResponseInterface { - if ($verify === GeneralUtility::hmac($frontendUser->getUid())) { + if ($verify === GeneralUtility::makeInstance(HashService::class)->hmac($frontendUser->getUid(), 'changeMe')) { $this->frontendUserRepository->update($frontendUser); $this->persistenceManager->persistAll(); - $successMessage = LocalizationUtility::translate('updateFrontendUser.success', - $this->request->getControllerExtensionName()); + $successMessage = LocalizationUtility::translate( + 'updateFrontendUser.success', + $this->request->getControllerExtensionName() + ); $this->addFlashMessage($successMessage); - $this->redirect('edit', null, null, - ['verify' => $verify, 'ruid' => base64_encode($frontendUser->getUid())]); - } else { - return new ForwardResponse('updateError'); + return $this->redirect( + 'edit', + null, + null, + ['verify' => $verify, 'ruid' => base64_encode($frontendUser->getUid())] + ); } + return new ForwardResponse('updateError'); } /** @@ -211,18 +208,14 @@ public function updateErrorAction(): ResponseInterface return $this->htmlResponse(); } - /** - * @param string $ruid - * @param string $verify - */ public function deleteAction(string $ruid = '', string $verify = ''): ResponseInterface { - $frontendUserUid = (int)base64_decode($ruid); - if (!$frontendUserUid) { + $frontendUserUid = (int) base64_decode($ruid); + if ($frontendUserUid === 0) { return new ForwardResponse('deleteError'); } - if ($verify === GeneralUtility::hmac($frontendUserUid)) { + if ($verify === GeneralUtility::makeInstance(HashService::class)->hmac($frontendUserUid, 'changeMe')) { $frontendUser = $this->frontendUserRepository->findByUid($frontendUserUid); if ($frontendUser instanceof FrontendUser) { $this->frontendUserRepository->remove($frontendUser); @@ -244,11 +237,6 @@ public function deleteErrorAction(): ResponseInterface return $this->htmlResponse(); } - /** - * @param integer $uid - * @param string $action - * @return string - */ protected function createOptInUri(int $uid, string $action = 'activate'): string { $arguments = [ @@ -256,25 +244,17 @@ protected function createOptInUri(int $uid, string $action = 'activate'): string 'controller' => 'FrontendUser', 'action' => $action, 'ruid' => base64_encode($uid), - 'verify' => GeneralUtility::hmac($uid), + 'verify' => GeneralUtility::makeInstance(HashService::class)->hmac($uid, 'changeMe'), ], ]; return $this->uriBuilder->reset()->setCreateAbsoluteUri(true)->setArguments($arguments)->build(); } - /** - * @param string $email - * @param string $subject - * @param string $content - * @param string $replyTo - * @param string $returnPath - * @return bool - */ protected function sendEmail(string $email, string $subject, string $content, string $replyTo = '', string $returnPath = ''): bool { - /** @var $message \TYPO3\CMS\Core\Mail\MailMessage */ - $message = GeneralUtility::makeInstance('TYPO3\CMS\Core\Mail\MailMessage'); + /** @var MailMessage $message */ + $message = GeneralUtility::makeInstance(MailMessage::class); $message->addTo($email); $message->setFrom([$this->settings['sender']['email'] => $this->settings['sender']['name']]); @@ -305,16 +285,6 @@ protected function sendEmail(string $email, string $subject, string $content, st return $message->isSent(); } - public function injectFrontendUserRepository(FrontendUserRepository $frontendUserRepository): void - { - $this->frontendUserRepository = $frontendUserRepository; - } - - public function injectPersistenceManager(PersistenceManager $persistenceManager): void - { - $this->persistenceManager = $persistenceManager; - } - protected function getRandomPassword(): string { $randomPassword = GeneralUtility::makeInstance(Random::class)->generateRandomBytes(32); @@ -327,5 +297,4 @@ protected function getHashedPassword(string $password): string $hashInstance = GeneralUtility::makeInstance(PasswordHashFactory::class)->getDefaultHashInstance('FE'); return $hashInstance->getHashedPassword($password); } - } diff --git a/Classes/Domain/Model/FrontendUser.php b/Classes/Domain/Model/FrontendUser.php index c78097c..18bb353 100644 --- a/Classes/Domain/Model/FrontendUser.php +++ b/Classes/Domain/Model/FrontendUser.php @@ -3,8 +3,10 @@ namespace Visol\Newsletterregistration\Domain\Model; use TYPO3\CMS\Extbase\Annotation as Extbase; -use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup; +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; + /** * This file is part of the TYPO3 CMS project. * @@ -19,118 +21,137 @@ */ /** * A Frontend User - * - * @api */ -class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser +class FrontendUser extends AbstractEntity { - /** * @var ObjectStorage */ - protected $usergroup = null; + protected $usergroup; - /** - * @var string - */ - protected $gender; + protected string $gender; - /** - * @var boolean - */ - protected $activateNewsletter; + protected bool $activateNewsletter; - /** - * @var boolean - */ - protected $receiveHtmlMail; + protected bool $receiveHtmlMail; - /** - * @var boolean - */ - protected $disable; + protected bool $disable; - /** - * @var string - * @Extbase\Validate("EmailAddress") - * @Extbase\Validate("NotEmpty") - */ - protected $email; + #[Extbase\Validate(['validator' => 'EmailAddress'])] + #[Extbase\Validate(['validator' => 'NotEmpty'])] + protected string $email; - /** - * Constructs a new Front-End User - * - * @api - * @param string $username - * @param string $password - */ - public function __construct($username = '', $password = '') + public function __construct( + protected string $username = '', + protected string $password = '', + protected string $firstName = '', + protected string $lastName = '', + ) { + } + + public function setUsername(string $username): void { - parent::__construct($username, $password); + $this->username = $username; } - /** - * @return string - */ - public function getGender() + public function getUsername(): string + { + return $this->username; + } + + public function setPassword(string $password): void + { + $this->password = $password; + } + + public function getPassword(): string + { + return $this->password; + } + + public function getGender(): string { return $this->gender; } - /** - * @param string $gender - */ - public function setGender($gender) + public function setGender(string $gender): void { $this->gender = $gender; } - /** - * @return boolean - */ - public function isActivateNewsletter() + public function isActivateNewsletter(): bool { return $this->activateNewsletter; } - /** - * @param boolean $activateNewsletter - */ - public function setActivateNewsletter($activateNewsletter) + public function setActivateNewsletter(bool $activateNewsletter): void { $this->activateNewsletter = $activateNewsletter; } - /** - * @return boolean - */ - public function isReceiveHtmlMail() + public function isReceiveHtmlMail(): bool { return $this->receiveHtmlMail; } - /** - * @param boolean $receiveHtmlMail - */ - public function setReceiveHtmlMail($receiveHtmlMail) + public function setReceiveHtmlMail(bool $receiveHtmlMail): void { $this->receiveHtmlMail = $receiveHtmlMail; } + public function isDisable(): bool + { + return $this->disable; + } + + public function setDisable(bool $disable): void + { + $this->disable = $disable; + } + + public function getEmail(): string + { + return $this->email; + } + + public function setEmail(string $email): void + { + $this->email = $email; + } + /** - * @return boolean + * @return ObjectStorage */ - public function isDisable() + public function getUsergroup(): ?ObjectStorage { - return $this->disable; + return $this->usergroup; } /** - * @param boolean $disable + * @param ObjectStorage $usergroup */ - public function setDisable($disable) + public function setUsergroup(ObjectStorage $usergroup): void { - $this->disable = $disable; + $this->usergroup = $usergroup; + } + + public function getFirstName(): string + { + return $this->firstName; } + public function setFirstName(string $firstName): void + { + $this->firstName = $firstName; + } + + public function getLastName(): string + { + return $this->lastName; + } + + public function setLastName(string $lastName): void + { + $this->lastName = $lastName; + } } diff --git a/Classes/Domain/Repository/FrontendUserRepository.php b/Classes/Domain/Repository/FrontendUserRepository.php index e26f161..78b2e0e 100644 --- a/Classes/Domain/Repository/FrontendUserRepository.php +++ b/Classes/Domain/Repository/FrontendUserRepository.php @@ -6,6 +6,7 @@ use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings; use TYPO3\CMS\Extbase\Persistence\Repository; use Visol\Newsletterregistration\Domain\Model\FrontendUser; + /** * This file is part of the TYPO3 CMS project. * @@ -20,8 +21,7 @@ */ class FrontendUserRepository extends Repository { - - public function initializeObject() + public function initializeObject(): void { $querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class); $querySettings->setRespectStoragePage(false); @@ -30,8 +30,8 @@ public function initializeObject() /** * @param string $email - * @param integer $targetFolder - * @return FrontendUser|NULL + * @param int $targetFolder + * @return FrontendUser|null */ public function findOneByEmailAndStoragePageId($email, $targetFolder) { @@ -65,5 +65,4 @@ public function findByUid($uid, bool $respectEnableFields = true): ?FrontendUser ) )->execute()->getFirst(); } - } diff --git a/Classes/Updates/VisolNewsletterregistrationCTypeMigration.php b/Classes/Updates/VisolNewsletterregistrationCTypeMigration.php new file mode 100644 index 0000000..731486f --- /dev/null +++ b/Classes/Updates/VisolNewsletterregistrationCTypeMigration.php @@ -0,0 +1,41 @@ + 'pi_plugin1', + * 'pi_plugin2' => 'new_content_element', + * ] + * + * @return array + */ + protected function getListTypeToCTypeMapping(): array + { + return [ + // TODO: Add this mapping yourself! + ]; + } +} diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php index d13fd60..c3145e5 100644 --- a/Configuration/Extbase/Persistence/Classes.php +++ b/Configuration/Extbase/Persistence/Classes.php @@ -9,11 +9,11 @@ 'tableName' => 'fe_users', 'properties' => [ 'activateNewsletter' => [ - 'fieldName' => 'module_sys_dmail_newsletter' + 'fieldName' => 'module_sys_dmail_newsletter', ], 'receiveHtmlMail' => [ - 'fieldName' => 'module_sys_dmail_html' + 'fieldName' => 'module_sys_dmail_html', ], - ] + ], ], ]; diff --git a/Configuration/FlexForm/flexform_newsletterregistration.xml b/Configuration/FlexForm/flexform_newsletterregistration.xml index 1e94346..1b7e45f 100644 --- a/Configuration/FlexForm/flexform_newsletterregistration.xml +++ b/Configuration/FlexForm/flexform_newsletterregistration.xml @@ -1,3 +1,4 @@ + 1 @@ -5,67 +6,59 @@ - - LLL:EXT:newsletterregistration/Resources/Private/Language/locallang.xlf:flexform.sheetTitle - + LLL:EXT:newsletterregistration/Resources/Private/Language/locallang.xlf:flexform.sheetTitle array - - - 0 - - - input - trim,required - 30 - - - - - - 0 - - - select - selectMultipleSideBySide - - - LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.gender - gender - - - LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.first_name - firstName - - - LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.last_name - lastName - - - LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.company - company - - - 0 - 99 - 8 - - - - - - 0 - - - group - db - pages - 1 - 1 - 1 - - - + + 0 + + + input + trim + 30 + 1 + + + + 0 + + + select + selectMultipleSideBySide + + + + gender + + + + firstName + + + + lastName + + + + company + + + 0 + 99 + 8 + + + + 0 + + + group + pages + 1 + 1 + 1 + + diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml new file mode 100644 index 0000000..574b1d5 --- /dev/null +++ b/Configuration/Services.yaml @@ -0,0 +1,8 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + Visol\Newsletterregistration\: + resource: '../Classes/*' diff --git a/Configuration/TCA/Overrides/fe_users.php b/Configuration/TCA/Overrides/fe_users.php index 3dccc34..51ad3a3 100644 --- a/Configuration/TCA/Overrides/fe_users.php +++ b/Configuration/TCA/Overrides/fe_users.php @@ -1,26 +1,34 @@ [ - 'label' => 'LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.gender', - 'config' => [ - 'type' => 'radio', - 'default' => 'm', - 'items' => [ - ['LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.gender.m', 'm'], - ['LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.gender.f', 'f'] - ] - ] - ], -]; +defined('TYPO3') || die(); + +(static function (): void { + $temporaryColumns = [ + 'gender' => [ + 'label' => 'LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.gender', + 'config' => [ + 'type' => 'radio', + 'default' => 'm', + 'items' => [ + ['label' => 'LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.gender.m', 'value' => 'm'], + ['label' => 'LLL:EXT:newsletterregistration/Resources/Private/Language/locallang_db.xlf:fe_users.gender.f', 'value' => 'f'], + ], + ], + ], + ]; -ExtensionManagementUtility::addTCAcolumns('fe_users', $temporaryColumns, true); + ExtensionManagementUtility::addTCAcolumns('fe_users', $temporaryColumns); -ExtensionManagementUtility::addToAllTCAtypes('fe_users', 'gender', '', 'after:company'); + ExtensionManagementUtility::addToAllTCAtypes('fe_users', 'gender', '', 'after:company'); -ExtensionManagementUtility::addToAllTCAtypes('fe_users', 'title,first_name,last_name', '', - 'after:gender'); + ExtensionManagementUtility::addToAllTCAtypes( + 'fe_users', + 'title,first_name,last_name', + '', + 'after:gender' + ); -$GLOBALS['TCA']['fe_users']['columns']['usergroup']['config']['minitems'] = 0; + $GLOBALS['TCA']['fe_users']['columns']['usergroup']['config']['minitems'] = 0; +})(); diff --git a/Configuration/TCA/Overrides/sys_template.php b/Configuration/TCA/Overrides/sys_template.php new file mode 100644 index 0000000..c4ebab7 --- /dev/null +++ b/Configuration/TCA/Overrides/sys_template.php @@ -0,0 +1,3 @@ + - -

+ +

+ +

- +
diff --git a/Resources/Public/Icons/Extension.gif b/Resources/Public/Icons/Extension.gif deleted file mode 100644 index 1a832d4..0000000 Binary files a/Resources/Public/Icons/Extension.gif and /dev/null differ diff --git a/Resources/Public/Icons/Extension.svg b/Resources/Public/Icons/Extension.svg new file mode 100644 index 0000000..e1b4537 --- /dev/null +++ b/Resources/Public/Icons/Extension.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/composer.json b/composer.json index 1b09582..82dfaab 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,6 @@ } }, "require": { - "typo3/cms-core": "^11.5" + "typo3/cms-core": "^13.4" } } diff --git a/ext_icon.gif b/ext_icon.gif deleted file mode 100644 index 1a832d4..0000000 Binary files a/ext_icon.gif and /dev/null differ diff --git a/ext_localconf.php b/ext_localconf.php index 9a11a53..c77e075 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,18 +1,20 @@ 'new,create,edit,update,pendingOptIn,activate,invalidLink,updateError,delete', - ], // non-cacheable actions - [ - FrontendUserController::class => 'new,create,edit,update,activate,delete' - ] -); +(static function (): void { + ExtensionUtility::configurePlugin( + 'newsletterregistration', + 'newsletterregistration', + [ + FrontendUserController::class => 'new,create,edit,update,pendingOptIn,activate,invalidLink,updateError,delete', + ], // non-cacheable actions + [ + FrontendUserController::class => 'new,create,edit,update,activate,delete', + ], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT + ); +})(); diff --git a/ext_tables.php b/ext_tables.php deleted file mode 100644 index 33abe67..0000000 --- a/ext_tables.php +++ /dev/null @@ -1,14 +0,0 @@ -