TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:38 +02:00
commit 4392dbe2ce
142 changed files with 11824 additions and 0 deletions
@@ -0,0 +1,85 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Scheduler\Form\Element;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Core\Resource\Index\ExtractorInterface;
use TYPO3\CMS\Core\Resource\Index\ExtractorRegistry;
/**
* Renders registered extractors
*
* This is rendered for config type=none, renderType=registeredExtractors
*
* @internal This is a specific hook implementation and is not considered part of the Public TYPO3 API.
*/
final class RegisteredExtractors extends AbstractFormElement
{
public function __construct(
private readonly ExtractorRegistry $extractorRegistry
) {}
public function render(): array
{
$lang = $this->getLanguageService();
$extractors = $this->extractorRegistry->getExtractors();
if ($extractors !== []) {
$bullets = [];
foreach ($extractors as $extractor) {
$bullets[] = sprintf(
'<li class="list-group-item" title="%s">%s%s</li>',
get_class($extractor),
sprintf(
$lang->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.fileStorageExtraction.registeredExtractors.extractor'),
$this->formatExtractorClassName($extractor),
$extractor->getPriority()
),
$this->getBackendUser()->shallDisplayDebugInformation() ? (' <code>[' . get_class($extractor) . ']</code>') : ''
);
}
$html = '
<div class="form-description">' . htmlspecialchars($lang->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.fileStorageExtraction.registeredExtractors.with_extractors')) . '</div>
<ul class="list-group mt-2">' . implode(LF, $bullets) . '</ul>
';
} else {
$html = '<div class="alert alert-warning">' . htmlspecialchars($lang->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.fileStorageExtraction.registeredExtractors.without_extractors')) . '/div>';
}
$resultArray['html'] = '
<fieldset>
<legend class="form-label t3js-formengine-label">
' . htmlspecialchars($lang->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.fileStorageExtraction.registeredExtractors')) . '
</legend>
' . $html . '
</fieldset>
';
return $resultArray;
}
/**
* Since the class name can be very long considering the namespace, only take the final
* part for better readability. The FQN of the class will be displayed as tooltip.
*/
private function formatExtractorClassName(ExtractorInterface $extractor): string
{
$extractorParts = explode('\\', get_class($extractor));
return (string)array_pop($extractorParts);
}
}
@@ -0,0 +1,214 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Scheduler\Form\Element;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\InvalidOptionException;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputDefinition;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Core\Console\CommandRegistry;
use TYPO3\CMS\Core\View\ViewFactoryData;
use TYPO3\CMS\Core\View\ViewFactoryInterface;
use TYPO3\CMS\Scheduler\Domain\Repository\SchedulerTaskRepository;
use TYPO3\CMS\Scheduler\Exception\InvalidTaskException;
use TYPO3\CMS\Scheduler\Service\TaskService;
use TYPO3\CMS\Scheduler\Task\ExecuteSchedulableCommandTask;
/**
* Creates an element and shows the available configuration (arguments and options) for a schedulable commands.
*
* @internal This is a specific hook implementation and is not considered part of the Public TYPO3 API.
*/
class SchedulableCommandConfigurationElement extends AbstractFormElement
{
public function __construct(
protected readonly TaskService $taskService,
protected readonly CommandRegistry $commandRegistry,
protected readonly SchedulerTaskRepository $taskRepository,
protected readonly ViewFactoryInterface $viewFactory,
) {}
public function render(): array
{
$resultArray = $this->initializeResultArray();
$selectedTaskType = $this->data['databaseRow']['tasktype'][0] ?? '';
if ($selectedTaskType === '') {
return $resultArray;
}
$parameterArray = $this->data['parameterArray'];
$itemName = $parameterArray['itemFormElName'];
try {
$taskObject = $this->taskRepository->findByUid((int)$this->data['databaseRow']['uid']);
} catch (\OutOfBoundsException) {
// This happens for new tasks when 'uid' is set to "0" because we have a Task Type from defVals
try {
$taskObject = $this->taskService->createNewTask($selectedTaskType);
} catch (InvalidTaskException) {
// Given task type is not registered - skip this element
return $resultArray;
}
}
if ($taskObject instanceof ExecuteSchedulableCommandTask === false) {
// Task is not an executable schedulable command task
return $resultArray;
}
try {
$command = $this->commandRegistry->get($selectedTaskType);
} catch (CommandNotFoundException) {
// Command not found
return $resultArray;
}
$argumentFields = $this->getCommandArgumentFields($command->getDefinition(), $taskObject);
$optionFields = $this->getCommandOptionFields($command->getDefinition(), $taskObject);
if ($argumentFields !== [] || $optionFields !== []) {
$fieldInformationResult = $this->renderFieldInformation();
$fieldInformationHtml = $fieldInformationResult['html'];
$resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
$html = [];
$html[] = '<div class="formengine-field-item t3js-formengine-field-item">';
$html[] = $fieldInformationHtml;
$html[] = '<div class="form-wizards-wrap">';
$html[] = $this->renderCommandConfiguration(array_merge($argumentFields, $optionFields), $selectedTaskType, $itemName);
$html[] = '</div>';
if ($this->data['command'] === 'edit') {
$html[] = $this->getRunOnCliInfo($taskObject, $command);
}
$html[] = '</div>';
$resultArray['html'] = $this->wrapWithFieldsetAndLegend(implode(LF, $html));
}
return $resultArray;
}
protected function getCommandArgumentFields(InputDefinition $inputDefinition, ExecuteSchedulableCommandTask $task): array
{
$fields = [];
$argumentValues = $task->getArguments();
foreach ($inputDefinition->getArguments() as $argument) {
$name = $argument->getName();
$defaultValue = $argument->getDefault();
$task->addDefaultValue($name, $defaultValue);
$value = $argumentValues[$name] ?? $defaultValue;
if (is_array($value) && $argument->isArray()) {
$value = implode(',', $value);
}
$fields['arguments'][$name] = [
'label' => 'Argument "' . $argument->getName() . '"',
'description' => $argument->getDescription(),
'value' => $value,
'required' => $argument->isRequired(),
];
}
return $fields;
}
protected function getCommandOptionFields(InputDefinition $inputDefinition, ExecuteSchedulableCommandTask $task): array
{
$fields = [];
$enabledOptions = $task->getOptions();
$optionValues = $task->getOptionValues();
foreach ($inputDefinition->getOptions() as $option) {
$name = $option->getName();
$defaultValue = $option->getDefault();
$task->addDefaultValue($name, $defaultValue);
$enabled = $enabledOptions[$name] ?? false;
$value = $optionValues[$name] ?? $defaultValue;
if (is_array($value) && $option->isArray()) {
$value = implode(',', $value);
}
$fields['options'][$name] = [
'label' => 'Option "' . $option->getName() . '"',
'description' => $option->getDescription(),
'enabled' => $enabled,
'value' => $value,
'valueOption' => $option->isValueRequired() || $option->isValueOptional() || $option->isArray(),
];
}
return $fields;
}
protected function getRunOnCliInfo(ExecuteSchedulableCommandTask $taskObject, Command $command): string
{
$options = [];
foreach ($taskObject->getOptions() as $name => $enabled) {
if ($enabled) {
$value = $taskObject->getOptionValues()[$name] ?? null;
$options['--' . $name] = ($value === true) ? '' : $value;
}
}
$parameters = array_merge($taskObject->getArguments(), $options);
try {
$input = new ArrayInput($parameters, $command->getDefinition());
$arguments = $input->__toString();
$cliCommand = '<pre class="language-bash mt-2 mb-0"><code class="language-bash">' . $command->getName() . ' ' . $arguments . '</code></pre>';
} catch (RuntimeException|InvalidArgumentException $e) {
$cliCommand = '<div class="badge badge-warning mt-2">' . htmlspecialchars(sprintf($this->getLanguageService()->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:msg.errorParsingArguments'), $e->getMessage())) . '</div>';
} catch (InvalidOptionException $e) {
$cliCommand = '<div class="badge badge-warning mt-2">' . htmlspecialchars(sprintf($this->getLanguageService()->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:msg.errorParsingOptions'), $e->getMessage())) . '</div>';
}
return '
<div class="card mt-3 mb-0">
<div class="card-header">
<div class="card-header-body">
<h2 class="card-title">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.runOnCli')) . '</h2>
' . $cliCommand . '
</div>
</div>
</div>
';
}
protected function renderCommandConfiguration(array $fields, string $taskType, string $itemName): string
{
return $this->viewFactory->create(
new ViewFactoryData(
templateRootPaths: ['EXT:scheduler/Resources/Private/Templates'],
partialRootPaths: ['EXT:scheduler/Resources/Private/Partials'],
layoutRootPaths: ['EXT:scheduler/Resources/Private/Layouts'],
request: $this->data['request'],
format: 'html',
)
)->assignMultiple([
'taskType' => $taskType,
'fields' => $fields,
'itemName' => $itemName,
'renderDebug' => $this->getBackendUser()->shallDisplayDebugInformation(),
])->render('CommandConfiguration');
}
}
@@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Scheduler\Form\Element;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Scheduler\Service\TaskService;
/**
* @internal This is a specific hook implementation and is not considered part of the Public TYPO3 API.
*/
class TaskTypeInfoElement extends AbstractFormElement
{
public function __construct(
private readonly TaskService $taskService,
private readonly IconFactory $iconFactory,
) {}
public function render(): array
{
$languageService = $this->getLanguageService();
$resultArray = $this->initializeResultArray();
$parameterArray = $this->data['parameterArray'];
$selectedValue = '';
if (!empty($parameterArray['itemFormElValue'])) {
if (is_array($parameterArray['itemFormElValue'])) {
$selectedValue = (string)$parameterArray['itemFormElValue'][0];
} else {
$selectedValue = (string)$parameterArray['itemFormElValue'];
}
}
$taskDetails = $this->taskService->getTaskDetailsFromTaskType($selectedValue);
if ($taskDetails) {
$resultArray['html'] = '
<div class="card mb-0">
<div class="card-header">
<div class="card-icon">
' . $this->iconFactory->getIcon(($taskDetails['icon'] ?? '') ?: 'mimetypes-x-tx_scheduler_task_group')->render() . '
</div>
<div class="card-header-body">
<h2 class="card-title">' . htmlspecialchars($taskDetails['title']) . '</h2>
<span class="card-subtitle">' . htmlspecialchars($taskDetails['description']) . '</span>
</div>
</div>
</div>
';
} else {
$resultArray['html'] = '<div class="alert alert-warning">' . htmlspecialchars($languageService->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:msg.invalidTaskType')) . ': <code>' . htmlspecialchars($selectedValue) . '</code></div>';
}
$resultArray['html'] .= '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($selectedValue) . '" />';
return $resultArray;
}
}
@@ -0,0 +1,170 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Scheduler\Form\Element;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Backend\Form\Element\CheckboxElement;
use TYPO3\CMS\Backend\Form\Element\DatetimeElement;
use TYPO3\CMS\Backend\Form\Element\InputTextElement;
use TYPO3\CMS\Backend\Form\Element\RadioElement;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Domain\DateTimeFactory;
use TYPO3\CMS\Core\Page\JavaScriptModuleInstruction;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\View\ViewFactoryData;
use TYPO3\CMS\Core\View\ViewFactoryInterface;
use TYPO3\CMS\Scheduler\Execution;
/**
* Creates an element to show a lot of details.
*
* This is rendered for config type=json, renderType=schedulerTimingOptions
*
* @internal This is a specific hook implementation and is not considered part of the Public TYPO3 API.
*/
class TimingOptionsElement extends AbstractFormElement
{
public function __construct(
private readonly ViewFactoryInterface $viewFactory,
private readonly Context $context,
) {}
public function render(): array
{
$languageService = $this->getLanguageService();
$resultArray = $this->initializeResultArray();
$parameterArray = $this->data['parameterArray'];
$itemValue = $parameterArray['itemFormElValue'];
$itemName = $parameterArray['itemFormElName'];
if (is_array($itemValue) && $itemValue !== []) {
$executionDetails = Execution::createFromDetails($itemValue);
} else {
$executionDetails = new Execution();
// Set the default value to "in 5 minutes"
$executionDetails->setStart($this->context->getPropertyFromAspect('date', 'accessTime') + (5 * 60));
}
$fieldsHtml = '';
$runningType = GeneralUtility::makeInstance(RadioElement::class);
$runningType->data = $this->data;
$runningType->data['containerFieldName'] = 'runningType';
$runningType->data['parameterArray']['fieldConf']['label'] = htmlspecialchars($languageService->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:runningType'));
$runningType->data['parameterArray']['itemFormElName'] .= '[runningType]';
$runningType->data['parameterArray']['fieldConf']['config']['items'] = [
['label' => $languageService->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.type.single'), 'value' => 1],
['label' => $languageService->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.type.recurring'), 'value' => 2],
];
$runningType->data['parameterArray']['itemFormElValue'] = $executionDetails->isSingleRun() ? 1 : 2;
$runningType->data['parameterArray']['fieldChangeFunc'] = [];
$runningType->data['parameterArray']['fieldConf'] = array_replace_recursive($runningType->data['parameterArray']['fieldConf'], $parameterArray['fieldConf']['config']['overrideFieldTca']['runningType'] ?? []);
$subFieldResult = $runningType->render();
$resultArray['javaScriptModules'] = array_merge($resultArray['javaScriptModules'], $subFieldResult['javaScriptModules']);
$fieldsHtml .= '<div class="form-group col-sm-6 t3js-timing-options-runningType">' . str_replace('"form-check"', '"form-check form-inline me-2"', $subFieldResult['html']) . '</div>';
$multiple = GeneralUtility::makeInstance(CheckboxElement::class);
$multiple->data = $this->data;
$multiple->data['containerFieldName'] = 'multiple';
$multiple->data['parameterArray']['fieldConf']['label'] = htmlspecialchars($languageService->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.parallel.long'));
$multiple->data['parameterArray']['itemFormElName'] .= '[multiple]';
$multiple->data['parameterArray']['fieldConf']['config']['items'] = [];
$multiple->data['parameterArray']['fieldChangeFunc'] = [];
$multiple->data['parameterArray']['itemFormElValue'] = $executionDetails->isParallelExecutionAllowed();
$multiple->data['parameterArray']['fieldConf'] = array_replace_recursive($multiple->data['parameterArray']['fieldConf'], $parameterArray['fieldConf']['config']['overrideFieldTca']['multiple'] ?? []);
$subFieldResult = $multiple->render();
$resultArray['javaScriptModules'] = array_merge($resultArray['javaScriptModules'], $subFieldResult['javaScriptModules']);
$fieldsHtml .= '<div class="form-group col-sm-6 t3js-timing-options-parallel">' . $subFieldResult['html'] . '</div>';
$start = GeneralUtility::makeInstance(DatetimeElement::class);
$start->data = $this->data;
$start->data['containerFieldName'] = 'start';
$start->data['parameterArray']['fieldConf']['label'] = htmlspecialchars($languageService->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:scheduledFrom'));
$start->data['parameterArray']['itemFormElName'] .= '[start]';
$start->data['parameterArray']['itemFormElValue'] = DateTimeFactory::createFromTimestamp($executionDetails->getStart() ?: $this->context->getPropertyFromAspect('date', 'timestamp'));
$start->data['parameterArray']['fieldConf'] = array_replace_recursive($start->data['parameterArray']['fieldConf'], $parameterArray['fieldConf']['config']['overrideFieldTca']['start'] ?? []);
$subFieldResult = $start->render();
$resultArray['javaScriptModules'] = array_merge($resultArray['javaScriptModules'], $subFieldResult['javaScriptModules']);
$fieldsHtml .= '<div class="form-group col-sm-6 t3js-timing-options-start">' . $subFieldResult['html'] . '</div>';
$end = GeneralUtility::makeInstance(DatetimeElement::class);
$end->data = $this->data;
$end->data['containerFieldName'] = 'end';
$end->data['parameterArray']['fieldConf']['label'] = htmlspecialchars($languageService->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:scheduledUntil'));
$end->data['parameterArray']['itemFormElName'] .= '[end]';
$end->data['parameterArray']['itemFormElValue'] = $executionDetails->getEnd() ? DateTimeFactory::createFromTimestamp($executionDetails->getEnd()) : null;
$end->data['parameterArray']['fieldConf'] = array_replace_recursive($end->data['parameterArray']['fieldConf'], $parameterArray['fieldConf']['config']['overrideFieldTca']['end'] ?? []);
$subFieldResult = $end->render();
$resultArray['javaScriptModules'] = array_merge($resultArray['javaScriptModules'], $subFieldResult['javaScriptModules']);
$fieldsHtml .= '<div class="form-group col-sm-6 t3js-timing-options-end">' . $subFieldResult['html'] . '</div>';
$frequency = GeneralUtility::makeInstance(InputTextElement::class);
$frequency->data = $this->data;
$frequency->data['containerFieldName'] = 'frequency';
$frequency->data['parameterArray']['fieldConf']['label'] = htmlspecialchars($languageService->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:label.frequency.long'));
$frequency->data['parameterArray']['itemFormElName'] .= '[frequency]';
$frequency->data['parameterArray']['itemFormElValue'] = $executionDetails->getCronCmd() ?: $executionDetails->getInterval();
$frequency->data['parameterArray']['fieldChangeFunc'] = [];
$frequency->data['parameterArray']['fieldConf']['config']['size'] = 40;
$frequency->data['parameterArray']['fieldConf'] = array_replace_recursive($frequency->data['parameterArray']['fieldConf'], $parameterArray['fieldConf']['config']['overrideFieldTca']['frequency'] ?? []);
$subFieldResult = $frequency->render();
$resultArray['javaScriptModules'] = array_merge($resultArray['javaScriptModules'], $subFieldResult['javaScriptModules']);
$fieldsHtml .= '<div class="form-group t3js-timing-options-frequency">' . $subFieldResult['html'] . '</div>';
$fieldInformationResult = $this->renderFieldInformation();
$fieldInformationHtml = $fieldInformationResult['html'];
$resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
$html = [];
$html[] = '<typo3-formengine-element-timing-options class="formengine-field-item t3js-formengine-field-item" fieldPrefix="' . htmlspecialchars($itemName) . '">';
$html[] = $fieldInformationHtml;
$html[] = '<div class="form-control-wrap" style="max-width: ' . $this->formMaxWidth((int)($this->defaultInputWidth * 1.5)) . 'px">';
$html[] = '<div class="form-wizards-wrap">';
$html[] = '<div class="form-wizards-item-element">';
$html[] = '<div class="row">' . $fieldsHtml . $this->renderServerTime() . '</div>';
$html[] = '</div>';
$html[] = '</div>';
$html[] = '</div>';
$html[] = '</typo3-formengine-element-timing-options>';
$resultArray['html'] = $this->wrapWithFieldsetAndLegend(implode(LF, $html));
$resultArray['javaScriptModules'][] = JavaScriptModuleInstruction::create('@typo3/scheduler/form-engine/element/timing-options-element.js');
return $resultArray;
}
protected function renderServerTime(): string
{
$view = $this->viewFactory->create(
new ViewFactoryData(
templateRootPaths: ['EXT:scheduler/Resources/Private/Templates'],
partialRootPaths: ['EXT:scheduler/Resources/Private/Partials'],
layoutRootPaths: ['EXT:scheduler/Resources/Private/Layouts'],
request: $this->data['request'],
format: 'html',
)
);
$view->assignMultiple([
'dateFormat' => [
'day' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] ?? 'd-m-y',
'time' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] ?? 'H:i',
],
]);
return $view->render('ServerTime');
}
}
@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Scheduler\Form\FieldInformation;
use TYPO3\CMS\Backend\Form\AbstractNode;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask;
/**
* Renders "expiresPeriod" information for the selected table, which is used if nothing is specified for this field manually.
*
* @internal This is a specific scheduler implementation and is not considered part of the Public TYPO3 API.
*/
class ExpirePeriodInformation extends AbstractNode
{
public function render(): array
{
$resultArray = $this->initializeResultArray();
if ($this->data['command'] !== 'edit'
|| $this->data['tableName'] !== 'tx_scheduler_task'
|| (int)($this->data['parameterArray']['itemFormElValue'] ?? 0) > 0
) {
return $resultArray;
}
$refField = (string)($this->data['renderData']['fieldInformationOptions']['refField'] ?? '');
if (($this->data['databaseRow'][$refField] ?? false) === false) {
return $resultArray;
}
$selectedTable = (string)(is_array($this->data['databaseRow'][$refField]) ? $this->data['databaseRow'][$refField][0] : $this->data['databaseRow'][$refField]);
$tableConfiguration = GeneralUtility::makeInstance(TableGarbageCollectionTask::class)->getTableConfiguration()[$selectedTable] ?? [];
if (!isset($tableConfiguration['expirePeriod'])) {
return $resultArray;
}
$resultArray['html'] = '
<div class="badge badge-info mb-2">
' . sprintf($this->getLanguageService()->sL('LLL:EXT:scheduler/Resources/Private/Language/locallang.xlf:msg.defaultExpirePeriod'), (int)$tableConfiguration['expirePeriod'], $selectedTable) . '
</div>';
return $resultArray;
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}