Project

General

Profile

Actions

Bug #91256

closed

PSR-14 configuration available before fireing AfterPackageActivationEvent

Added by Roman Büchler over 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
System/Bootstrap/Configuration
Target version:
-
Start date:
2020-05-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The use case is an extension changing the site's branding (e.g. be login screen).

With TYPO3 V9 a signal could have been setup for that purpose:

$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
$signalSlotDispatcher->connect(
    \TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class,
    'afterExtensionInstall',
    \Buepro\Pizpalue\Service\BrandingService::class,
    'setBackendStyling'
);

When trying to achieve the same with an event it doesn't work because the configuration defined in Configuration/Services.yaml isn't available. The configuration looks as following:

services:
    _defaults:
        autowire: true
        autoconfigure: true
        public: false

    Buepro\Pizpalue\:
        resource: '../Classes/*'

    Buepro\Pizpalue\Service\BrandingService:
        tags:
            - name: event.listener
              identifier: 'pizpalue-branding'
              method: 'handlePackageActivationEvent'
              event: TYPO3\CMS\Core\Package\Event\AfterPackageActivationEvent

Could the InstallUtility be adjusted in the following way:

public function install(...$extensionKeys)
{
    ...

    $this->reloadCaches();
    $this->updateDatabase();

    // Read in PSR-14 configuration

    ...

    foreach ($extensionKeys as $extensionKey) {
        $this->processExtensionSetup($extensionKey);
        $this->eventDispatcher->dispatch(new AfterPackageActivationEvent($extensionKey, 'typo3-cms-extension', $this));
    }
}
Actions

Also available in: Atom PDF