TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?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\Domain\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Context\LanguageAspect;
|
||||
|
||||
/**
|
||||
* Event which is fired after a record was translated (or tried to be localized).
|
||||
*/
|
||||
final class AfterRecordLanguageOverlayEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $table,
|
||||
private readonly array $record,
|
||||
private ?array $localizedRecord,
|
||||
private bool $overlayingWasAttempted,
|
||||
private readonly LanguageAspect $languageAspect
|
||||
) {}
|
||||
|
||||
public function getTable(): string
|
||||
{
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
public function getRecord(): array
|
||||
{
|
||||
return $this->record;
|
||||
}
|
||||
|
||||
public function getLanguageAspect(): LanguageAspect
|
||||
{
|
||||
return $this->languageAspect;
|
||||
}
|
||||
|
||||
public function setLocalizedRecord(?array $localizedRecord): void
|
||||
{
|
||||
$this->overlayingWasAttempted = true;
|
||||
$this->localizedRecord = $localizedRecord;
|
||||
}
|
||||
|
||||
public function getLocalizedRecord(): ?array
|
||||
{
|
||||
return $this->localizedRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the overlay functionality happened, thus, returning the lo
|
||||
*/
|
||||
public function overlayingWasAttempted(): bool
|
||||
{
|
||||
return $this->overlayingWasAttempted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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\Domain\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Context\Context;
|
||||
use TYPO3\CMS\Core\Domain\Page;
|
||||
|
||||
/**
|
||||
* Event which is fired before a page (id) is being resolved from PageRepository.
|
||||
*
|
||||
* Allows to change the corresponding page ID, e.g. to resolve a different page
|
||||
* with custom overlaying, or to fully resolve the page on your own.
|
||||
*/
|
||||
final class BeforePageIsRetrievedEvent
|
||||
{
|
||||
private ?Page $page = null;
|
||||
|
||||
public function __construct(
|
||||
private int $pageId,
|
||||
private bool $skipGroupAccessCheck,
|
||||
private readonly Context $context,
|
||||
) {}
|
||||
|
||||
public function getPage(): ?Page
|
||||
{
|
||||
return $this->page;
|
||||
}
|
||||
|
||||
public function setPage(Page $page): void
|
||||
{
|
||||
$this->page = $page;
|
||||
}
|
||||
|
||||
public function hasPage(): bool
|
||||
{
|
||||
return $this->page !== null;
|
||||
}
|
||||
|
||||
public function getPageId(): int
|
||||
{
|
||||
return $this->pageId;
|
||||
}
|
||||
|
||||
public function setPageId(int $pageId): void
|
||||
{
|
||||
$this->pageId = $pageId;
|
||||
}
|
||||
|
||||
public function skipGroupAccessCheck(): void
|
||||
{
|
||||
$this->skipGroupAccessCheck = true;
|
||||
}
|
||||
|
||||
public function respectGroupAccessCheck(): void
|
||||
{
|
||||
$this->skipGroupAccessCheck = false;
|
||||
}
|
||||
|
||||
public function isGroupAccessCheckSkipped(): bool
|
||||
{
|
||||
return $this->skipGroupAccessCheck;
|
||||
}
|
||||
|
||||
public function getContext(): Context
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?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\Domain\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Context\LanguageAspect;
|
||||
|
||||
/**
|
||||
* Event which is fired before a single page or a list of
|
||||
* pages are about to be translated (or tried to be localized).
|
||||
*/
|
||||
final class BeforePageLanguageOverlayEvent
|
||||
{
|
||||
public function __construct(
|
||||
private array $pageInput,
|
||||
private array $pageIds,
|
||||
private LanguageAspect $languageAspect
|
||||
) {}
|
||||
|
||||
public function getPageInput(): array
|
||||
{
|
||||
return $this->pageInput;
|
||||
}
|
||||
|
||||
public function setPageInput(array $pageInput): void
|
||||
{
|
||||
$this->pageInput = $pageInput;
|
||||
}
|
||||
|
||||
public function getPageIds(): array
|
||||
{
|
||||
return $this->pageIds;
|
||||
}
|
||||
|
||||
public function setPageIds(array $pageIds): void
|
||||
{
|
||||
$this->pageIds = array_map(intval(...), $pageIds);
|
||||
}
|
||||
|
||||
public function getLanguageAspect(): LanguageAspect
|
||||
{
|
||||
return $this->languageAspect;
|
||||
}
|
||||
|
||||
public function setLanguageAspect(LanguageAspect $languageAspect): void
|
||||
{
|
||||
$this->languageAspect = $languageAspect;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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\Domain\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Context\LanguageAspect;
|
||||
|
||||
/**
|
||||
* Event which is fired before a record in a language should be "language overlaid",
|
||||
* that is: Finding a translation for a given record.
|
||||
*/
|
||||
final class BeforeRecordLanguageOverlayEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $table,
|
||||
private array $record,
|
||||
private LanguageAspect $languageAspect
|
||||
) {}
|
||||
|
||||
public function getTable(): string
|
||||
{
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
public function getRecord(): array
|
||||
{
|
||||
return $this->record;
|
||||
}
|
||||
|
||||
public function setRecord(array $record): void
|
||||
{
|
||||
$this->record = $record;
|
||||
}
|
||||
|
||||
public function getLanguageAspect(): LanguageAspect
|
||||
{
|
||||
return $this->languageAspect;
|
||||
}
|
||||
|
||||
public function setLanguageAspect(LanguageAspect $languageAspect): void
|
||||
{
|
||||
$this->languageAspect = $languageAspect;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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\Domain\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Context\Context;
|
||||
use TYPO3\CMS\Core\Database\Query\Expression\CompositeExpression;
|
||||
use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder;
|
||||
|
||||
/**
|
||||
* Event which is fired when compiling the list of constraints such as "deleted" and "starttime",
|
||||
* "endtime" etc.
|
||||
*
|
||||
* This Event allows for additional enableColumns to be added or removed to the list of constraints.
|
||||
*
|
||||
* An example: The extension ingmar_accessctrl enables assigning more
|
||||
* than one usergroup to content and page records
|
||||
*/
|
||||
final class ModifyDefaultConstraintsForDatabaseQueryEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $table,
|
||||
private readonly string $tableAlias,
|
||||
private readonly ExpressionBuilder $expressionBuilder,
|
||||
/** @var array<string, CompositeExpression|string> */
|
||||
private array $constraints,
|
||||
/** @var array<string, bool> */
|
||||
private readonly array $enableFieldsToIgnore,
|
||||
private readonly Context $context
|
||||
) {}
|
||||
|
||||
public function getTable(): string
|
||||
{
|
||||
return $this->table;
|
||||
}
|
||||
|
||||
public function getTableAlias(): string
|
||||
{
|
||||
return $this->tableAlias;
|
||||
}
|
||||
|
||||
public function getExpressionBuilder(): ExpressionBuilder
|
||||
{
|
||||
return $this->expressionBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, CompositeExpression|string>
|
||||
*/
|
||||
public function getConstraints(): array
|
||||
{
|
||||
return $this->constraints;
|
||||
}
|
||||
|
||||
public function setConstraints(array $constraints): void
|
||||
{
|
||||
$this->constraints = $constraints;
|
||||
}
|
||||
|
||||
public function getEnableFieldsToIgnore(): array
|
||||
{
|
||||
return array_keys(array_filter($this->enableFieldsToIgnore));
|
||||
}
|
||||
|
||||
public function getContext(): Context
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?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\Domain\Event;
|
||||
|
||||
use Psr\EventDispatcher\StoppableEventInterface;
|
||||
use TYPO3\CMS\Core\Context\Context;
|
||||
use TYPO3\CMS\Core\Domain\Persistence\RecordIdentityMap;
|
||||
use TYPO3\CMS\Core\Domain\RawRecord;
|
||||
use TYPO3\CMS\Core\Domain\Record\SystemProperties;
|
||||
use TYPO3\CMS\Core\Domain\RecordInterface;
|
||||
use TYPO3\CMS\Core\Schema\TcaSchema;
|
||||
|
||||
/**
|
||||
* Event which allows to manipulate the properties to be used for a new Record.
|
||||
* With this event, it's even possible to create a new Record manually.
|
||||
*/
|
||||
final class RecordCreationEvent implements StoppableEventInterface
|
||||
{
|
||||
public function __construct(
|
||||
private array $properties,
|
||||
private readonly RawRecord $rawRecord,
|
||||
private readonly SystemProperties $systemProperties,
|
||||
private readonly Context $context,
|
||||
private readonly RecordIdentityMap $recordIdentityMap,
|
||||
private readonly TcaSchema $schema,
|
||||
private ?RecordInterface $record = null,
|
||||
) {}
|
||||
|
||||
public function setRecord(RecordInterface $record): void
|
||||
{
|
||||
$this->record = $record;
|
||||
}
|
||||
|
||||
public function isPropagationStopped(): bool
|
||||
{
|
||||
return $this->record !== null;
|
||||
}
|
||||
|
||||
public function hasProperty(string $name): bool
|
||||
{
|
||||
return array_key_exists($name, $this->properties);
|
||||
}
|
||||
|
||||
public function setProperty(string $name, mixed $propertyValue): void
|
||||
{
|
||||
$this->properties[$name] = $propertyValue;
|
||||
}
|
||||
|
||||
public function setProperties(array $properties): void
|
||||
{
|
||||
$this->properties = $properties;
|
||||
}
|
||||
|
||||
public function unsetProperty(string $name): bool
|
||||
{
|
||||
if (!$this->hasProperty($name)) {
|
||||
return false;
|
||||
}
|
||||
unset($this->properties[$name]);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getProperty(string $name): mixed
|
||||
{
|
||||
return $this->properties[$name] ?? null;
|
||||
}
|
||||
|
||||
public function getProperties(): array
|
||||
{
|
||||
return $this->properties;
|
||||
}
|
||||
|
||||
public function getRawRecord(): RawRecord
|
||||
{
|
||||
return $this->rawRecord;
|
||||
}
|
||||
|
||||
public function getSystemProperties(): SystemProperties
|
||||
{
|
||||
return $this->systemProperties;
|
||||
}
|
||||
|
||||
public function getContext(): Context
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
public function getRecordIdentityMap(): RecordIdentityMap
|
||||
{
|
||||
return $this->recordIdentityMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* If available this is the subSchema for the current record type
|
||||
*/
|
||||
public function getSchema(): TcaSchema
|
||||
{
|
||||
return $this->schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function getRecord(): ?RecordInterface
|
||||
{
|
||||
return $this->record;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user