TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
/**
|
||||
* Listeners to this event are able to modify or enhance the data structure identifier,
|
||||
* which is used for a given TCA flex field.
|
||||
*
|
||||
* This event can be used to add additional data to an identifier. Be careful here, especially if
|
||||
* stuff from the source record like uid or pid is added! This may easily lead to issues with
|
||||
* data handler details like copy or move records, localization and version overlays.
|
||||
* Test this very well! Multiple listeners may add information to the same identifier here -
|
||||
* take care to namespace array keys. Information added here can be later used in the
|
||||
* data structure related PSR-14 Events (BeforeFlexFormDataStructureParsedEvent and
|
||||
* AfterFlexFormDataStructureParsedEvent) again.
|
||||
*
|
||||
* See the note on FlexFormTools regarding the schema of $dataStructure.
|
||||
*/
|
||||
final class AfterFlexFormDataStructureIdentifierInitializedEvent
|
||||
{
|
||||
/**
|
||||
* @param array $fieldTca Full TCA of the field in question that has type=flex set
|
||||
* @param string $tableName The table name of the TCA field
|
||||
* @param string $fieldName The field name
|
||||
* @param array $row The data row
|
||||
* @param array $identifier The data structure identifier (set by event listener of the default)
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly array $fieldTca,
|
||||
private readonly string $tableName,
|
||||
private readonly string $fieldName,
|
||||
private readonly array $row,
|
||||
private array $identifier,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Returns the full TCA of the currently handled field, having
|
||||
* `type=flex` set.
|
||||
*/
|
||||
public function getFieldTca(): array
|
||||
{
|
||||
return $this->fieldTca;
|
||||
}
|
||||
|
||||
public function getTableName(): string
|
||||
{
|
||||
return $this->tableName;
|
||||
}
|
||||
|
||||
public function getFieldName(): string
|
||||
{
|
||||
return $this->fieldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the whole database row of the current record.
|
||||
*/
|
||||
public function getRow(): array
|
||||
{
|
||||
return $this->row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to modify or completely replace the initialized data
|
||||
* structure identifier.
|
||||
*/
|
||||
public function setIdentifier(array $identifier): void
|
||||
{
|
||||
$this->identifier = $identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the initialized data structure identifier, which has
|
||||
* either been defined by an event listener or set to the default
|
||||
* by the `FlexFormTools` component.
|
||||
*/
|
||||
public function getIdentifier(): array
|
||||
{
|
||||
return $this->identifier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
/**
|
||||
* Listeners to this event are able to modify or enhance a flex form data
|
||||
* structure that corresponds to a given identifier, after it was parsed and
|
||||
* before it is used by further components.
|
||||
*
|
||||
* Note: Since this event is not stoppable, all registered listeners are
|
||||
* called. Therefore, you might want to namespace your identifiers in a way,
|
||||
* that there is little chance they overlap (e.g. prefix with extension name).
|
||||
*
|
||||
* See the note on FlexFormTools regarding the schema of $dataStructure.
|
||||
*/
|
||||
final class AfterFlexFormDataStructureParsedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private array $dataStructure,
|
||||
private readonly array $identifier,
|
||||
) {}
|
||||
|
||||
public function getIdentifier(): array
|
||||
{
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current data structure, which has been processed and
|
||||
* parsed by the `FlexFormTools` component. Might contain additional
|
||||
* data from previously called listeners.
|
||||
*/
|
||||
public function getDataStructure(): array
|
||||
{
|
||||
return $this->dataStructure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to modify or completely replace the parsed data
|
||||
* structure identifier.
|
||||
*/
|
||||
public function setDataStructure(array $dataStructure): void
|
||||
{
|
||||
$this->dataStructure = $dataStructure;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
final class AfterRichtextConfigurationPreparedEvent
|
||||
{
|
||||
public function __construct(private array $configuration) {}
|
||||
|
||||
public function getConfiguration(): array
|
||||
{
|
||||
return $this->configuration;
|
||||
}
|
||||
|
||||
public function setConfiguration(array $configuration): void
|
||||
{
|
||||
$this->configuration = $configuration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
/**
|
||||
* Event after $tca which later becomes $GLOBALS['TCA'] has been built.
|
||||
* Allows to further manipulate $tca before it is cached and set as $GLOBALS['TCA'].
|
||||
*/
|
||||
final class AfterTcaCompilationEvent
|
||||
{
|
||||
public function __construct(private array $tca) {}
|
||||
|
||||
public function getTca(): array
|
||||
{
|
||||
return $this->tca;
|
||||
}
|
||||
|
||||
public function setTca(array $tca): void
|
||||
{
|
||||
$this->tca = $tca;
|
||||
}
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
use Psr\EventDispatcher\StoppableEventInterface;
|
||||
|
||||
/**
|
||||
* Listeners to this event are able to specify the data structure identifier,
|
||||
* used for a given TCA flex field.
|
||||
*
|
||||
* Listeners should call ->setIdentifier() to set the identifier or ignore the
|
||||
* event to allow other listeners to set it. Do not set an empty string as this
|
||||
* will immediately stop event propagation!
|
||||
*
|
||||
* The identifier SHOULD include the keys specified in the Identifier definition
|
||||
* on FlexFormTools, and nothing else. Adding other keys may or may not work,
|
||||
* depending on other code that is enabled, and they are not guaranteed nor
|
||||
* covered by BC guarantees.
|
||||
*
|
||||
* Warning: If adding source record details like the uid or pid here, this may turn out to be fragile.
|
||||
* Be sure to test scenarios like workspaces and data handler copy/move well, additionally, this may
|
||||
* break in between different core versions.
|
||||
* It is probably a good idea to return at least something like [ 'type' => 'myExtension', ... ], see
|
||||
* the core internal 'tca' and 'record' return values below
|
||||
*
|
||||
* See the note on FlexFormTools regarding the schema of $dataStructure.
|
||||
*/
|
||||
final class BeforeFlexFormDataStructureIdentifierInitializedEvent implements StoppableEventInterface
|
||||
{
|
||||
private ?array $identifier = null;
|
||||
|
||||
/**
|
||||
* @param array $fieldTca Full TCA of the field in question that has type=flex set
|
||||
* @param string $tableName The table name of the TCA field
|
||||
* @param string $fieldName The field name
|
||||
* @param array $row The data row
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly array $fieldTca,
|
||||
private readonly string $tableName,
|
||||
private readonly string $fieldName,
|
||||
private readonly array $row,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Returns the full TCA of the currently handled field, having
|
||||
* `type=flex` set.
|
||||
*/
|
||||
public function getFieldTca(): array
|
||||
{
|
||||
return $this->fieldTca;
|
||||
}
|
||||
|
||||
public function getTableName(): string
|
||||
{
|
||||
return $this->tableName;
|
||||
}
|
||||
|
||||
public function getFieldName(): string
|
||||
{
|
||||
return $this->fieldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the whole database row of the current record.
|
||||
*/
|
||||
public function getRow(): array
|
||||
{
|
||||
return $this->row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to define the data structure identifier for the TCA field.
|
||||
* Setting an identifier will immediately stop propagation. Avoid
|
||||
* setting this parameter to an empty array as this will also stop
|
||||
* propagation.
|
||||
*/
|
||||
public function setIdentifier(array $identifier): void
|
||||
{
|
||||
$this->identifier = $identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current data structure identifier, which will always be
|
||||
* `null` for listeners, since the event propagation is
|
||||
* stopped as soon as a listener defines an identifier.
|
||||
*/
|
||||
public function getIdentifier(): ?array
|
||||
{
|
||||
return $this->identifier ?? null;
|
||||
}
|
||||
|
||||
public function isPropagationStopped(): bool
|
||||
{
|
||||
return isset($this->identifier);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
use Psr\EventDispatcher\StoppableEventInterface;
|
||||
|
||||
/**
|
||||
* Listeners to this event are able to specify a flex form data structure that
|
||||
* corresponds to a given identifier.
|
||||
*
|
||||
* Listeners should call ->setDataStructure() to set the data structure (this
|
||||
* can either be a resolved data structure string, a "FILE:" reference or a
|
||||
* fully parsed data structure as array) or ignore the event to allow other
|
||||
* listeners to set it. Do not set an empty array or string as this will
|
||||
* immediately stop event propagation!
|
||||
*
|
||||
* See the note on FlexFormTools regarding the schema of $dataStructure.
|
||||
*/
|
||||
final class BeforeFlexFormDataStructureParsedEvent implements StoppableEventInterface
|
||||
{
|
||||
private array|string|null $dataStructure = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly array $identifier,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Returns the current data structure, which will always be `null`
|
||||
* for listeners, since the event propagation is stopped as soon as
|
||||
* a listener sets a data structure.
|
||||
*/
|
||||
public function getDataStructure(): array|string|null
|
||||
{
|
||||
return $this->dataStructure ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to either set an already parsed data structure as `array`,
|
||||
* a file reference or the XML structure as `string`. Setting a data
|
||||
* structure will immediately stop propagation. Avoid setting this parameter
|
||||
* to an empty array or string as this will also stop propagation.
|
||||
*/
|
||||
public function setDataStructure(array|string $dataStructure): void
|
||||
{
|
||||
$this->dataStructure = $dataStructure;
|
||||
}
|
||||
|
||||
public function getIdentifier(): array
|
||||
{
|
||||
return $this->identifier;
|
||||
}
|
||||
|
||||
public function isPropagationStopped(): bool
|
||||
{
|
||||
return isset($this->dataStructure);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
/**
|
||||
* Event before $tca which later becomes $GLOBALS['TCA'] is overridden by TCA/Overrides.
|
||||
* Allows to manipulate $tca, before overrides are merged.
|
||||
*/
|
||||
final class BeforeTcaOverridesEvent
|
||||
{
|
||||
public function __construct(private array $tca) {}
|
||||
|
||||
public function getTca(): array
|
||||
{
|
||||
return $this->tca;
|
||||
}
|
||||
|
||||
public function setTca(array $tca): void
|
||||
{
|
||||
$this->tca = $tca;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
/**
|
||||
* Event fired before a site configuration is written to a yaml file
|
||||
* allows dynamic modification of the site's configuration before writing.
|
||||
*/
|
||||
final class SiteConfigurationBeforeWriteEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $siteIdentifier,
|
||||
private array $configuration
|
||||
) {}
|
||||
|
||||
public function getSiteIdentifier(): string
|
||||
{
|
||||
return $this->siteIdentifier;
|
||||
}
|
||||
|
||||
public function getConfiguration(): array
|
||||
{
|
||||
return $this->configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $configuration overwrite the configuration array of the site
|
||||
*/
|
||||
public function setConfiguration(array $configuration): void
|
||||
{
|
||||
$this->configuration = $configuration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final readonly class SiteConfigurationChangedEvent
|
||||
{
|
||||
public function __construct(
|
||||
public string $siteIdentifier,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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\Core\Configuration\Event;
|
||||
|
||||
/**
|
||||
* Event after a site configuration has been read from a yaml file
|
||||
* before it is cached - allows dynamic modification of the site's configuration.
|
||||
*/
|
||||
final class SiteConfigurationLoadedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $siteIdentifier,
|
||||
private array $configuration
|
||||
) {}
|
||||
|
||||
public function getSiteIdentifier(): string
|
||||
{
|
||||
return $this->siteIdentifier;
|
||||
}
|
||||
|
||||
public function getConfiguration(): array
|
||||
{
|
||||
return $this->configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $configuration overwrite the configuration array of the site
|
||||
*/
|
||||
public function setConfiguration(array $configuration): void
|
||||
{
|
||||
$this->configuration = $configuration;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user