ModifyNewSchedulerTaskWizardItemsEvent 

New in version 14.0

The PSR-14 event \TYPO3\CMS\Scheduler\Event\ModifyNewSchedulerTaskWizardItemsEvent allows extensions to modify the items in the wizard used to create a new task in backend module Administration > Scheduler.

Example: listening for a ModifyNewSchedulerTaskWizardItemsEvent 

The following example adds an additional item to the scheduler task wizard, removes an existing item and modifies one.

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

namespace MyVendor\MyExtension\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Scheduler\Event\ModifyNewSchedulerTaskWizardItemsEvent;

final readonly class ModifySchedulerTaskWizardListener
{
  #[AsEventListener('my-extension/scheduler/modify-wizard-items')]
  public function __invoke(ModifyNewSchedulerTaskWizardItemsEvent $event): void
  {
    // Add a custom task to the wizard
    $event->addWizardItem('my_custom_task', [
      'title' => 'My Custom Task',
      'description' => 'A custom task provided by my extension',
      'iconIdentifier' => 'my-custom-icon',
      'taskType' => 'MyVendor\\MyExtension\\Task\\CustomTask',
      'taskClass' => 'MyVendor\\MyExtension\\Task\\CustomTask',
    ]);

    // Remove an existing task
    $event->removeWizardItem('redirects_redirects:checkintegrity');

    // Modify existing wizard items
    $wizardItems = $event->getWizardItems();
    foreach ($wizardItems as $key => $item) {
      if (isset($item['title']) && str_contains($item['title'], 'referenceindex:update')) {
        $item['title'] = 'Update reference index';
        $event->addWizardItem($key, $item);
      }
    }
  }
}
Copied!

API of ModifyNewSchedulerTaskWizardItemsEvent 

final class ModifyNewSchedulerTaskWizardItemsEvent
Fully qualified name
\TYPO3\CMS\Scheduler\Event\ModifyNewSchedulerTaskWizardItemsEvent

Listeners to this event are able to modify the scheduler task items for the new task wizard

getWizardItems()
Returns
array
setWizardItems(array $wizardItems)
param $wizardItems

the wizardItems

addWizardItem(string $key, array $wizardItem)
param $key

the key

param $wizardItem

the wizardItem

removeWizardItem(string $key)
param $key

the key

getRequest()
Returns
\Psr\Http\Message\ServerRequestInterface