TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:00 +02:00
commit f9941541b7
1178 changed files with 135377 additions and 0 deletions
@@ -0,0 +1,108 @@
<?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\Backend\Form\Event;
/**
* Listeners to this Event will be able to add custom controls to a TCA type="file" field in FormEngine
*/
final class CustomFileControlsEvent
{
private array $controls = [];
public function __construct(
private array $resultArray,
private readonly string $tableName,
private readonly string $fieldName,
private readonly array $databaseRow,
private readonly array $fieldConfig,
private readonly string $formFieldIdentifier,
private readonly string $formFieldName,
) {}
public function getResultArray(): array
{
return $this->resultArray;
}
/**
* WARNING: Modifying the result array should be used with care. It mostly
* only exists to allow additional $resultArray['javaScriptModules'].
*/
public function setResultArray(array $resultArray): void
{
$this->resultArray = $resultArray;
}
public function getControls(): array
{
return $this->controls;
}
public function setControls(array $controls): void
{
$this->controls = $controls;
}
public function addControl(string $control, string $identifier = ''): void
{
if ($identifier !== '') {
$this->controls[$identifier] = $control;
} else {
$this->controls[] = $control;
}
}
public function removeControl(string $identifier): bool
{
if (!isset($this->controls[$identifier])) {
return false;
}
unset($this->controls[$identifier]);
return true;
}
public function getTableName(): string
{
return $this->tableName;
}
public function getFieldName(): string
{
return $this->fieldName;
}
public function getDatabaseRow(): array
{
return $this->databaseRow;
}
public function getFieldConfig(): array
{
return $this->fieldConfig;
}
public function getFormFieldIdentifier(): string
{
return $this->formFieldIdentifier;
}
public function getFormFieldName(): string
{
return $this->formFieldName;
}
}
@@ -0,0 +1,88 @@
<?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\Backend\Form\Event;
use TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter;
/**
* Listeners to this Event will be able to add custom file selectors to a
* TCA type="file" field in FormEngine
*/
final class CustomFileSelectorsEvent
{
public function __construct(
private array $selectors,
private array $javascriptModules,
private readonly string $tableName,
private readonly string $fieldName,
private readonly array $databaseRow,
private readonly array $fieldConfig,
private readonly FileExtensionFilter $fileExtensionFilter,
private readonly string $formFieldIdentifier,
) {}
public function getSelectors(): array
{
return $this->selectors;
}
public function setSelectors(array $selectors): void
{
$this->selectors = $selectors;
}
public function getJavascriptModules(): array
{
return $this->javascriptModules;
}
public function setJavascriptModules(array $javascriptModules): void
{
$this->javascriptModules = $javascriptModules;
}
public function getTableName(): string
{
return $this->tableName;
}
public function getFieldName(): string
{
return $this->fieldName;
}
public function getDatabaseRow(): array
{
return $this->databaseRow;
}
public function getFieldConfig(): array
{
return $this->fieldConfig;
}
public function getFileExtensionFilter(): FileExtensionFilter
{
return $this->fileExtensionFilter;
}
public function getFormFieldIdentifier(): string
{
return $this->formFieldIdentifier;
}
}
@@ -0,0 +1,99 @@
<?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\Backend\Form\Event;
use TYPO3\CMS\Backend\Form\Exception\AccessDeniedException;
/**
* Listeners to this Event will be able to modify the user access
* decision for using FormEngine to create or edit a record.
*/
final class ModifyEditFormUserAccessEvent
{
private bool $userHasAccess;
/**
* @param 'new'|'edit' $command
*/
public function __construct(
private readonly ?AccessDeniedException $exception,
private readonly string $tableName,
private readonly string $command,
private readonly array $databaseRow,
) {
$this->userHasAccess = $this->exception === null;
}
/**
* Allows user access to the editing form
*/
public function allowUserAccess(): void
{
$this->userHasAccess = true;
}
/**
* Denies user access to the editing form
*/
public function denyUserAccess(): void
{
$this->userHasAccess = false;
}
/**
* Returns the current user access state
*/
public function doesUserHaveAccess(): bool
{
return $this->userHasAccess;
}
/**
* If Core's DataProvider previously denied access, this returns the corresponding
* exception, `null` otherwise
*/
public function getAccessDeniedException(): ?AccessDeniedException
{
return $this->exception;
}
/**
* Returns the table name of the record in question
*/
public function getTableName(): string
{
return $this->tableName;
}
/**
* Returns the requested command, either `new` or `edit`
* @return 'new'|'edit'
*/
public function getCommand(): string
{
return $this->command;
}
/**
* Returns the record's database row
*/
public function getDatabaseRow(): array
{
return $this->databaseRow;
}
}
@@ -0,0 +1,135 @@
<?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\Backend\Form\Event;
/**
* Listeners to this Event will be able to modify the controls
* of a single file reference of a TCA type=file field.
*/
final class ModifyFileReferenceControlsEvent
{
public function __construct(
private array $controls,
private readonly array $data,
private readonly array $record,
) {}
/**
* Returns all controls with their markup
*/
public function getControls(): array
{
return $this->controls;
}
/**
* Overwrite the controls
*/
public function setControls(array $controls): void
{
$this->controls = $controls;
}
/**
* Returns the markup for the requested control
*/
public function getControl(string $identifier): string
{
return $this->controls[$identifier] ?? '';
}
/**
* Set a control with the given identifier and markup
* IMPORTANT: Overwrites an existing control with the same identifier
*/
public function setControl(string $identifier, string $markup): void
{
$this->controls[$identifier] = $markup;
}
/**
* Returns whether a control exists for the given identifier
*/
public function hasControl(string $identifier): bool
{
return isset($this->controls[$identifier]);
}
/**
* Removes a control from the file reference, if it exists
*
* @return bool Whether the control could be removed
*/
public function removeControl(string $identifier): bool
{
if (!$this->hasControl($identifier)) {
return false;
}
unset($this->controls[$identifier]);
return true;
}
/**
* Returns the whole element data
*/
public function getElementData(): array
{
return $this->data;
}
/**
* Returns the current record, the controls are created for
*/
public function getRecord(): array
{
return $this->record;
}
/**
* Returns the uid of the parent (embedding) record (uid or NEW...)
*/
public function getParentUid(): string
{
return (string)($this->data['inlineParentUid'] ?? '');
}
/**
* Returns the table (foreign_table) the controls are created for
*/
public function getForeignTable(): string
{
return (string)($this->getFieldConfiguration()['foreign_table'] ?? 'sys_file_reference');
}
/**
* Returns the TCA configuration of the TCA type=file field
*/
public function getFieldConfiguration(): array
{
return (array)($this->data['inlineParentConfig'] ?? []);
}
/**
* Returns whether the current records is only virtually shown and not physically part of the parent record
*/
public function isVirtual(): bool
{
return (bool)($this->data['isInlineDefaultLanguageRecordInLocalizedParentContext'] ?? false);
}
}
@@ -0,0 +1,147 @@
<?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\Backend\Form\Event;
/**
* Listeners to this Event will be able to modify the state (enabled or disabled) for controls of a file reference
*/
final class ModifyFileReferenceEnabledControlsEvent
{
/**
* @var array<string, bool>
*/
private array $controlsState;
public function __construct(
private readonly array $data,
private readonly array $record,
) {
$this->controlsState = (array)($data['inlineParentConfig']['appearance']['enabledControls'] ?? []);
}
/**
* Enable a control, if it exists
*
* @return bool Whether the control could be enabled
*/
public function enableControl(string $identifier): bool
{
if (!$this->hasControl($identifier)) {
return false;
}
$this->controlsState[$identifier] = true;
return true;
}
/**
* Disable a control, if it exists
*
* @return bool Whether the control could be disabled
*/
public function disableControl(string $identifier): bool
{
if (!$this->hasControl($identifier)) {
return false;
}
$this->controlsState[$identifier] = false;
return true;
}
/**
* Returns whether a control exists for the given identifier
*/
public function hasControl(string $identifier): bool
{
return isset($this->controlsState[$identifier]);
}
/**
* Returns whether the control is enabled.
* Note: Will also return FALSE in case no control exists for the requested identifier
*/
public function isControlEnabled(string $identifier): bool
{
return (bool)($this->controlsState[$identifier] ?? false);
}
/**
* Returns all controls with their state (enabled or disabled)
*/
public function getControlsState(): array
{
return $this->controlsState;
}
/**
* Returns all enabled controls
*/
public function getEnabledControls(): array
{
return array_filter($this->controlsState, static fn(mixed $control): bool => (bool)$control === true);
}
/**
* Returns the whole element data
*/
public function getElementData(): array
{
return $this->data;
}
/**
* Returns the current record of the controls are created for
*/
public function getRecord(): array
{
return $this->record;
}
/**
* Returns the uid of the parent (embedding) record (uid or NEW...)
*/
public function getParentUid(): string
{
return (string)($this->data['inlineParentUid'] ?? '');
}
/**
* Returns the table (foreign_table) the controls are created for
*/
public function getForeignTable(): string
{
return (string)($this->getFieldConfiguration()['foreign_table'] ?? '');
}
/**
* Returns the TCA configuration of the TCA type=file field
*/
public function getFieldConfiguration(): array
{
return (array)($this->data['inlineParentConfig'] ?? []);
}
/**
* Returns whether the current records is only virtually shown and not physically part of the parent record
*/
public function isVirtual(): bool
{
return (bool)($this->data['isInlineDefaultLanguageRecordInLocalizedParentContext'] ?? false);
}
}
@@ -0,0 +1,59 @@
<?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\Backend\Form\Event;
use TYPO3\CMS\Core\Resource\File;
/**
* Listeners to this Event will be able to modify the preview url, used in the ImageManipulation element
*/
final class ModifyImageManipulationPreviewUrlEvent
{
private string $previewUrl = '';
public function __construct(
private readonly array $databaseRow,
private readonly array $fieldConfiguration,
private readonly File $file,
) {}
public function getDatabaseRow(): array
{
return $this->databaseRow;
}
public function getFieldConfiguration(): array
{
return $this->fieldConfiguration;
}
public function getFile(): File
{
return $this->file;
}
public function getPreviewUrl(): string
{
return $this->previewUrl;
}
public function setPreviewUrl(string $previewUrl): void
{
$this->previewUrl = $previewUrl;
}
}
@@ -0,0 +1,134 @@
<?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\Backend\Form\Event;
/**
* Listeners to this Event will be able to modify the controls of an inline element
*/
final class ModifyInlineElementControlsEvent
{
public function __construct(
private array $controls,
private readonly array $data,
private readonly array $record,
) {}
/**
* Returns all controls with their markup
*/
public function getControls(): array
{
return $this->controls;
}
/**
* Overwrite the controls
*/
public function setControls(array $controls): void
{
$this->controls = $controls;
}
/**
* Returns the markup for the requested control
*/
public function getControl(string $identifier): string
{
return $this->controls[$identifier] ?? '';
}
/**
* Set a control with the given identifier and markup
* IMPORTANT: Overwrites an existing control with the same identifier
*/
public function setControl(string $identifier, string $markup): void
{
$this->controls[$identifier] = $markup;
}
/**
* Returns whether a control exists for the given identifier
*/
public function hasControl(string $identifier): bool
{
return isset($this->controls[$identifier]);
}
/**
* Removes a control from the inline element, if it exists
*
* @return bool Whether the control could be removed
*/
public function removeControl(string $identifier): bool
{
if (!$this->hasControl($identifier)) {
return false;
}
unset($this->controls[$identifier]);
return true;
}
/**
* Returns the whole element data
*/
public function getElementData(): array
{
return $this->data;
}
/**
* Returns the current record of the controls are created for
*/
public function getRecord(): array
{
return $this->record;
}
/**
* Returns the uid of the parent (embedding) record (uid or NEW...)
*/
public function getParentUid(): string
{
return (string)($this->data['inlineParentUid'] ?? '');
}
/**
* Returns the table (foreign_table) the controls are created for
*/
public function getForeignTable(): string
{
return (string)($this->getFieldConfiguration()['foreign_table'] ?? '');
}
/**
* Returns the TCA configuration of the inline record field
*/
public function getFieldConfiguration(): array
{
return (array)($this->data['inlineParentConfig'] ?? []);
}
/**
* Returns whether the current records is only virtually shown and not physically part of the parent record
*/
public function isVirtual(): bool
{
return (bool)($this->data['isInlineDefaultLanguageRecordInLocalizedParentContext'] ?? false);
}
}
@@ -0,0 +1,147 @@
<?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\Backend\Form\Event;
/**
* Listeners to this Event will be able to modify the state (enabled or disabled) for controls of an inline element
*/
final class ModifyInlineElementEnabledControlsEvent
{
/**
* @var array<string, bool>
*/
private array $controlsState;
public function __construct(
private readonly array $data,
private readonly array $record,
) {
$this->controlsState = (array)($data['inlineParentConfig']['appearance']['enabledControls'] ?? []);
}
/**
* Enable a control, if it exists
*
* @return bool Whether the control could be enabled
*/
public function enableControl(string $identifier): bool
{
if (!$this->hasControl($identifier)) {
return false;
}
$this->controlsState[$identifier] = true;
return true;
}
/**
* Disable a control, if it exists
*
* @return bool Whether the control could be disabled
*/
public function disableControl(string $identifier): bool
{
if (!$this->hasControl($identifier)) {
return false;
}
$this->controlsState[$identifier] = false;
return true;
}
/**
* Returns whether a control exists for the given identifier
*/
public function hasControl(string $identifier): bool
{
return isset($this->controlsState[$identifier]);
}
/**
* Returns whether the control is enabled.
* Note: Will also return FALSE in case no control exists for the requested identifier
*/
public function isControlEnabled(string $identifier): bool
{
return (bool)($this->controlsState[$identifier] ?? false);
}
/**
* Returns all controls with their state (enabled or disabled)
*/
public function getControlsState(): array
{
return $this->controlsState;
}
/**
* Returns all enabled controls
*/
public function getEnabledControls(): array
{
return array_filter($this->controlsState, static fn(mixed $control): bool => (bool)$control === true);
}
/**
* Returns the whole element data
*/
public function getElementData(): array
{
return $this->data;
}
/**
* Returns the current record of the controls are created for
*/
public function getRecord(): array
{
return $this->record;
}
/**
* Returns the uid of the parent (embedding) record (uid or NEW...)
*/
public function getParentUid(): string
{
return (string)($this->data['inlineParentUid'] ?? '');
}
/**
* Returns the table (foreign_table) the controls are created for
*/
public function getForeignTable(): string
{
return (string)($this->getFieldConfiguration()['foreign_table'] ?? '');
}
/**
* Returns the TCA configuration of the inline record field
*/
public function getFieldConfiguration(): array
{
return (array)($this->data['inlineParentConfig'] ?? []);
}
/**
* Returns whether the current records is only virtually shown and not physically part of the parent record
*/
public function isVirtual(): bool
{
return (bool)($this->data['isInlineDefaultLanguageRecordInLocalizedParentContext'] ?? false);
}
}
@@ -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\Backend\Form\Event;
/**
* Listeners to this Event will be able to modify the link explanation array, used in FormEngine for link fields
*/
final class ModifyLinkExplanationEvent
{
private array $linkExplanation;
public function __construct(
array $linkExplanation,
private readonly array $linkData,
private readonly array $linkParts,
private readonly array $elementData,
) {
$this->linkExplanation = $linkExplanation;
}
public function getLinkData(): array
{
return $this->linkData;
}
public function getLinkParts(): array
{
return $this->linkParts;
}
public function getElementData(): array
{
return $this->elementData;
}
public function getLinkExplanation(): array
{
return $this->linkExplanation;
}
public function setLinkExplanation(array $linkExplanation): void
{
$this->linkExplanation = $linkExplanation;
}
public function getLinkExplanationValue(string $key, mixed $default = null): mixed
{
return $this->linkExplanation[$key] ?? $default;
}
public function setLinkExplanationValue(string $key, mixed $value): void
{
$this->linkExplanation[$key] = $value;
}
}