Issue Bug Closed

#93889Cannot modify language pack remote base URL

Xavier Perseguers 04/09/21, 09:50 updated 10/07/21, 07:14

Description

Since the move to PSR-14 one cannot modify the language pack remote base URL.

This is following event:

TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent

The reason is that the listener provider TYPO3\CMS\Core\EventDispatcher\ListenerProvider has an empty list of initialized listeners (member listeners), most probably in relation with the context (Install Tool).

Configuration

In EXT:yourExt/Configuration/Settings.yaml:

  VENDOR\YourExt\EventListener\InstallServiceEventListener:
    tags:
      - name: event.listener
        identifier: 'VENDOR/yourExt'
        method: 'modifyLanguagePackRemoteBaseUrl'
        event: TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent

Sample class VENDOR\YourExt\EventListener\InstallServiceEventListener:

namespace VENDOR\YourExt\EventListener;

use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent;

class InstallServiceEventListener
{

    /**
     * @param ModifyLanguagePackRemoteBaseUrlEvent $event
     */
    public function modifyLanguagePackRemoteBaseUrl(ModifyLanguagePackRemoteBaseUrlEvent $event): void
    {
        if ($event->getPackageKey() === 'yourExt') {
            $event->setBaseUrl(new Uri('https://www.example.com/packages/'));
        }
    }

}

Expected

The method is invoked.

What happens

The method is not invoked as no listeners seems to be registered in that context.

Reviews 2