ModifyLocalizationHandlerIsAvailableEvent 

New in version 14.2

The PSR-14 event \TYPO3\CMS\Backend\Localization\Event\ModifyLocalizationHandlerIsAvailableEvent is fired in LocalizationHandlerRegistry to allow overruling the available state of any registered localization handler based on the \LocalizationInstructions.

Example 

EXT:my_extension/Classes/Backend/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use TYPO3\CMS\Backend\Localization\Event\ModifyLocalizationHandlerIsAvailableEvent;
use TYPO3\CMS\Backend\Localization\LocalizationMode;
use TYPO3\CMS\Backend\Localization\ManualLocalizationHandler;
use TYPO3\CMS\Core\Attribute\AsEventListener;

final class DisableManualLocalizationHandlerForCustomTableEventListener
{
    #[AsEventListener(identifier: 'myextension/disable-manual-localization-handler-custom-table')]
    public function __invoke(
        ModifyLocalizationHandlerIsAvailableEvent $event,
    ): void {
        if ($event->identifier !== 'manual') {
            // Return early if not ManualLocalizationHandler
            return;
        }
        if ($event->className !== ManualLocalizationHandler::class) {
            // Return early in case manual identifier is provided but
            // customized (xlassed) class given. Just for the sake of
            // an example for that property.
        }
        if ($event->instructions->mode !== LocalizationMode::TRANSLATE) {
            // Return early in case not handling translation
            // (localization) mode.
            return;
        }

        if ($event->instructions->mainRecordType === 'my_custom_table') {
            // Disallow translation/localization for 'my_custom_table'
            // in general with the default core handler.
            $event->isAvailable = false;
        }
    }
}
Copied!

API 

class ModifyLocalizationHandlerIsAvailableEvent
Fully qualified name
\TYPO3\CMS\Backend\Localization\Event\ModifyLocalizationHandlerIsAvailableEvent

Fired in {@see LocalizationHandlerRegistry::getAvailableHandlers()} for each registered handler to allow overriding isAvailable state returned by the handler isAvailable() method. Main use-case is to disable handlers for special cases not implemented in the handler and mitigate the need to xclass them and reduces headaches in instances and for extension developers.

public readonly identifier
public readonly className
public readonly instructions
public isAvailable