TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* Event that allows to enhance or change content (also depending on enabled caching).
|
||||
* Depending on disable or enabling caching, the cache is then not stored in the pageCache.
|
||||
*
|
||||
* Until TYPO3 v13, the flag "isCachingEnabled" was available in $TSFE->no_cache.
|
||||
*/
|
||||
final class AfterCacheableContentIsGeneratedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request,
|
||||
private string $content,
|
||||
private readonly string $cacheIdentifier,
|
||||
private bool $usePageCache
|
||||
) {}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getContent(): string
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
public function setContent(string $content): void
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
public function isCachingEnabled(): bool
|
||||
{
|
||||
return $this->usePageCache;
|
||||
}
|
||||
|
||||
public function disableCaching(): void
|
||||
{
|
||||
$this->usePageCache = false;
|
||||
}
|
||||
|
||||
public function enableCaching(): void
|
||||
{
|
||||
$this->usePageCache = true;
|
||||
}
|
||||
|
||||
public function getCacheIdentifier(): string
|
||||
{
|
||||
return $this->cacheIdentifier;
|
||||
}
|
||||
}
|
||||
@@ -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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* Event that is used directly after all cached content is stored in the page cache.
|
||||
*
|
||||
* NOT fired, if:
|
||||
* * A page is called from the cache
|
||||
* * Caching is disabled using 'frontend.cache.instruction' request attribute, which can
|
||||
* be set by various middlewares or AfterCacheableContentIsGeneratedEvent
|
||||
*/
|
||||
final readonly class AfterCachedPageIsPersistedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private ServerRequestInterface $request,
|
||||
private string $cacheIdentifier,
|
||||
private array $cacheData,
|
||||
private int $cacheLifetime
|
||||
) {}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getCacheIdentifier(): string
|
||||
{
|
||||
return $this->cacheIdentifier;
|
||||
}
|
||||
|
||||
public function getCacheData(): array
|
||||
{
|
||||
return $this->cacheData;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount of seconds until the cache entry is invalid.
|
||||
*/
|
||||
public function getCacheLifetime(): int
|
||||
{
|
||||
return $this->cacheLifetime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* Event listeners are able to manipulate fetched page content, which is already grouped by column
|
||||
* @todo Consider deprecation due to introduction of ResolveContentAreasEvent
|
||||
*/
|
||||
final class AfterContentHasBeenFetchedEvent
|
||||
{
|
||||
public function __construct(
|
||||
public array $groupedContent,
|
||||
public readonly ServerRequestInterface $request,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
||||
use TYPO3\CMS\Frontend\Typolink\LinkResultInterface;
|
||||
|
||||
/**
|
||||
* Generic event to modify any kind of link generation with typolink(). This is processed by all
|
||||
* frontend-related links.
|
||||
*
|
||||
* If a link could not be generated, a "UnableToLinkException" could be thrown by an Event Listener.
|
||||
*/
|
||||
final class AfterLinkIsGeneratedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private LinkResultInterface $linkResult,
|
||||
private readonly ContentObjectRenderer $contentObjectRenderer,
|
||||
private readonly array $linkInstructions,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Update a link when a part was modified by an Event Listener.
|
||||
*/
|
||||
public function setLinkResult(LinkResultInterface $linkResult): void
|
||||
{
|
||||
$this->linkResult = $linkResult;
|
||||
}
|
||||
|
||||
public function getLinkResult(): LinkResultInterface
|
||||
{
|
||||
return $this->linkResult;
|
||||
}
|
||||
|
||||
public function getContentObjectRenderer(): ContentObjectRenderer
|
||||
{
|
||||
return $this->contentObjectRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the original instructions / $linkConfiguration that were used to build the link
|
||||
*/
|
||||
public function getLinkInstructions(): array
|
||||
{
|
||||
return $this->linkInstructions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Frontend\Page\PageInformation;
|
||||
|
||||
/**
|
||||
* A PSR-14 event fired in the frontend process after a given page has been resolved including
|
||||
* its language.
|
||||
*
|
||||
* This event is intended to e.g. modify TYPO3's language resolving logic by custom additions.
|
||||
* This event also allows to send a custom Response via Event Listeners (e.g. a custom 403 response)
|
||||
*/
|
||||
final class AfterPageAndLanguageIsResolvedEvent
|
||||
{
|
||||
private ?ResponseInterface $response = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request,
|
||||
private PageInformation $pageInformation,
|
||||
) {}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getPageInformation(): PageInformation
|
||||
{
|
||||
return $this->pageInformation;
|
||||
}
|
||||
|
||||
public function setPageInformation(PageInformation $pageInformation): void
|
||||
{
|
||||
$this->pageInformation = $pageInformation;
|
||||
}
|
||||
|
||||
public function getResponse(): ?ResponseInterface
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function setResponse(ResponseInterface $response): void
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
}
|
||||
@@ -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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Frontend\Page\PageInformation;
|
||||
|
||||
/**
|
||||
* A PSR-14 event fired in the frontend process after a given page has been resolved with permissions, rootline etc.
|
||||
* This is useful to modify the page + rootline (but before the language is resolved)
|
||||
* to direct or load content from a different page, or modify the page response if additional
|
||||
* permissions should be checked.
|
||||
*/
|
||||
final class AfterPageWithRootLineIsResolvedEvent
|
||||
{
|
||||
private ?ResponseInterface $response = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request,
|
||||
private PageInformation $pageInformation,
|
||||
) {}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function setResponse(ResponseInterface $response): void
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function getResponse(): ?ResponseInterface
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
public function getPageInformation(): PageInformation
|
||||
{
|
||||
return $this->pageInformation;
|
||||
}
|
||||
|
||||
public function setPageInformation(PageInformation $pageInformation): void
|
||||
{
|
||||
$this->pageInformation = $pageInformation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use TYPO3\CMS\Core\TypoScript\FrontendTypoScript;
|
||||
|
||||
/**
|
||||
* This event is dispatched after the FrontendTypoScript object has been calculated,
|
||||
* just before it is attached to the request.
|
||||
*
|
||||
* The event is designed to enable listeners to act on specific TypoScript conditions.
|
||||
* Listeners *must not* modify TypoScript at this point, the core will try to actively
|
||||
* prevent this.
|
||||
*
|
||||
* This event is especially useful when "upper" middlewares that do not have the
|
||||
* determined TypoScript need to behave differently depending on TypoScript 'config' that
|
||||
* is only created after them.
|
||||
* The core uses this in the TimeTrackInitialization and the WorkspacePreview middlewares,
|
||||
* to determine debugging and preview details.
|
||||
*
|
||||
* Note both 'settings' ("constants") and 'config' are *always* set within the
|
||||
* FrontendTypoScript at this point, even in 'fully cached page' scenarios. 'setup'
|
||||
* and (@internal) 'page' may not be set.
|
||||
*/
|
||||
final readonly class AfterTypoScriptDeterminedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private FrontendTypoScript $frontendTypoScript,
|
||||
) {}
|
||||
|
||||
public function getFrontendTypoScript(): FrontendTypoScript
|
||||
{
|
||||
return $this->frontendTypoScript;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use Psr\EventDispatcher\StoppableEventInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* Event dispatched before the DatabaseRecordLinkBuilder resolves a database record.
|
||||
*
|
||||
* This event is stoppable: If an event listener sets a record, the event propagation
|
||||
* will be stopped and the default record retrieval logic will be skipped.
|
||||
*/
|
||||
final class BeforeDatabaseRecordLinkResolvedEvent implements StoppableEventInterface
|
||||
{
|
||||
public function __construct(
|
||||
public readonly array $linkDetails,
|
||||
public readonly string $databaseTable,
|
||||
public readonly array $typoscriptConfiguration,
|
||||
public readonly array $tsConfig,
|
||||
public readonly ServerRequestInterface $request,
|
||||
public ?array $record = null
|
||||
) {}
|
||||
|
||||
public function isPropagationStopped(): bool
|
||||
{
|
||||
return $this->record !== null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* This event is dispatched just before the final page cache identifier is created,
|
||||
* that is used to get() - and later set(), if needed and allowed - the page cache row.
|
||||
*
|
||||
* The event retrieves all current arguments that will be part of the identifier
|
||||
* calculation and allows to add further arguments in case page caches need
|
||||
* to be more specific.
|
||||
*
|
||||
* This event can be helpful in various scenarios, for example to implement
|
||||
* proper page caching in A/B testing.
|
||||
*
|
||||
* Note this event is *always* dispatched, even in fully cached page scenarios,
|
||||
* if an outer middleware did not return early (for instance due to permission issues).
|
||||
*/
|
||||
final class BeforePageCacheIdentifierIsHashedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request,
|
||||
private array $pageCacheIdentifierParameters,
|
||||
) {}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getPageCacheIdentifierParameters(): array
|
||||
{
|
||||
return $this->pageCacheIdentifierParameters;
|
||||
}
|
||||
|
||||
public function setPageCacheIdentifierParameters(array $pageCacheIdentifierParameters): void
|
||||
{
|
||||
$this->pageCacheIdentifierParameters = $pageCacheIdentifierParameters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Frontend\Page\PageInformation;
|
||||
|
||||
/**
|
||||
* A PSR-14 event fired before the frontend process is trying to fully resolve a given page
|
||||
* by its page ID and the request.
|
||||
*
|
||||
* Event Listeners can modify incoming parameters (such as $controller->id) or modify the context
|
||||
* for resolving a page.
|
||||
*/
|
||||
final class BeforePageIsResolvedEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request,
|
||||
private PageInformation $pageInformation,
|
||||
) {}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getPageInformation(): PageInformation
|
||||
{
|
||||
return $this->pageInformation;
|
||||
}
|
||||
|
||||
public function setPageInformation(PageInformation $pageInformation): void
|
||||
{
|
||||
$this->pageInformation = $pageInformation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Context\Context;
|
||||
use TYPO3\CMS\Core\Site\Entity\Site;
|
||||
|
||||
/**
|
||||
* Listeners to this Event will be able to modify items for a menu generated with HMENU
|
||||
*/
|
||||
final class FilterMenuItemsEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly array $allMenuItems,
|
||||
private array $filteredMenuItems,
|
||||
private readonly array $menuConfiguration,
|
||||
private readonly array $itemConfiguration,
|
||||
private readonly array $bannedMenuItems,
|
||||
private readonly array $excludedDoktypes,
|
||||
private readonly Site $site,
|
||||
private readonly Context $context,
|
||||
private readonly array $currentPage
|
||||
) {}
|
||||
|
||||
public function getAllMenuItems(): array
|
||||
{
|
||||
return $this->allMenuItems;
|
||||
}
|
||||
|
||||
public function getFilteredMenuItems(): array
|
||||
{
|
||||
return $this->filteredMenuItems;
|
||||
}
|
||||
|
||||
public function setFilteredMenuItems(array $filteredMenuItems): void
|
||||
{
|
||||
$this->filteredMenuItems = $filteredMenuItems;
|
||||
}
|
||||
|
||||
public function getMenuConfiguration(): array
|
||||
{
|
||||
return $this->menuConfiguration;
|
||||
}
|
||||
|
||||
public function getItemConfiguration(): array
|
||||
{
|
||||
return $this->itemConfiguration;
|
||||
}
|
||||
|
||||
public function getBannedMenuItems(): array
|
||||
{
|
||||
return $this->bannedMenuItems;
|
||||
}
|
||||
|
||||
public function getExcludedDoktypes(): array
|
||||
{
|
||||
return $this->excludedDoktypes;
|
||||
}
|
||||
|
||||
public function getSite(): Site
|
||||
{
|
||||
return $this->site;
|
||||
}
|
||||
|
||||
public function getContext(): Context
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
public function getCurrentPage(): array
|
||||
{
|
||||
return $this->currentPage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use TYPO3\CMS\Core\Context\Context;
|
||||
|
||||
/**
|
||||
* Event to allow listeners to modify the amount of seconds that a generated frontend page
|
||||
* should be cached in the "pages" cache when initially generated.
|
||||
*/
|
||||
final class ModifyCacheLifetimeForPageEvent
|
||||
{
|
||||
public function __construct(
|
||||
private int $cacheLifetime,
|
||||
private readonly int $pageId,
|
||||
private readonly array $pageRecord,
|
||||
private readonly array $renderingInstructions,
|
||||
private readonly Context $context
|
||||
) {}
|
||||
|
||||
public function setCacheLifetime(int $cacheLifetime): void
|
||||
{
|
||||
$this->cacheLifetime = $cacheLifetime;
|
||||
}
|
||||
|
||||
public function getCacheLifetime(): int
|
||||
{
|
||||
return $this->cacheLifetime;
|
||||
}
|
||||
|
||||
public function getPageId(): int
|
||||
{
|
||||
return $this->pageId;
|
||||
}
|
||||
|
||||
public function getPageRecord(): array
|
||||
{
|
||||
return $this->pageRecord;
|
||||
}
|
||||
|
||||
public function getRenderingInstructions(): array
|
||||
{
|
||||
return $this->renderingInstructions;
|
||||
}
|
||||
|
||||
public function getContext(): Context
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
/**
|
||||
* Event to allow listeners to modify the amount of seconds that a page
|
||||
* containing this record should be cached.
|
||||
*/
|
||||
class ModifyCacheLifetimeForRowEvent
|
||||
{
|
||||
public function __construct(
|
||||
public int $cacheLifetime,
|
||||
public readonly string $tableName,
|
||||
public readonly array $pageRecord
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* Listeners to this event will be able to modify the hreflang tags that will be generated. You can use this when you
|
||||
* have an edge case language scenario and need to alter the default hreflang tags.
|
||||
*/
|
||||
final class ModifyHrefLangTagsEvent
|
||||
{
|
||||
private array $hrefLangs = [];
|
||||
|
||||
public function __construct(private readonly ServerRequestInterface $request) {}
|
||||
|
||||
public function getHrefLangs(): array
|
||||
{
|
||||
return $this->hrefLangs;
|
||||
}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the hreflangs. This should be an array in format:
|
||||
*
|
||||
* ```
|
||||
* [
|
||||
* 'en-US' => 'https://example.com',
|
||||
* 'nl-NL' => 'https://example.com/nl'
|
||||
* ]
|
||||
* ```
|
||||
*
|
||||
* @param array $hrefLangs
|
||||
*/
|
||||
public function setHrefLangs(array $hrefLangs): void
|
||||
{
|
||||
$this->hrefLangs = $hrefLangs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a hreflang tag to the current list of hreflang tags
|
||||
*
|
||||
* @param string $languageCode The language of the hreflang tag you would like to add. For example: nl-NL
|
||||
* @param string $url The URL of the translation. For example: https://example.com/nl
|
||||
*/
|
||||
public function addHrefLang(string $languageCode, string $url): void
|
||||
{
|
||||
$this->hrefLangs[$languageCode] = $url;
|
||||
}
|
||||
}
|
||||
@@ -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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* A generic PSR 14 Event to allow modifying the incoming (and resolved) page when building a "page link".
|
||||
*
|
||||
* This event allows Event Listener to change the page to be linked to, or add/remove possible query
|
||||
* parameters / fragments to be generated.
|
||||
*/
|
||||
final class ModifyPageLinkConfigurationEvent
|
||||
{
|
||||
private bool $pageWasModified = false;
|
||||
|
||||
public function __construct(
|
||||
private array $configuration,
|
||||
private readonly array $linkDetails,
|
||||
private array $page,
|
||||
private array $queryParameters,
|
||||
private string $fragment,
|
||||
private readonly ServerRequestInterface $request,
|
||||
) {}
|
||||
|
||||
public function getConfiguration(): array
|
||||
{
|
||||
return $this->configuration;
|
||||
}
|
||||
|
||||
public function setConfiguration(array $configuration): void
|
||||
{
|
||||
$this->configuration = $configuration;
|
||||
}
|
||||
|
||||
public function getLinkDetails(): array
|
||||
{
|
||||
return $this->linkDetails;
|
||||
}
|
||||
|
||||
public function getPage(): array
|
||||
{
|
||||
return $this->page;
|
||||
}
|
||||
|
||||
public function setPage(array $page): void
|
||||
{
|
||||
$this->page = $page;
|
||||
$this->pageWasModified = true;
|
||||
}
|
||||
|
||||
public function getQueryParameters(): array
|
||||
{
|
||||
return $this->queryParameters;
|
||||
}
|
||||
|
||||
public function setQueryParameters(array $queryParameters): void
|
||||
{
|
||||
$this->queryParameters = $queryParameters;
|
||||
}
|
||||
|
||||
public function getFragment(): string
|
||||
{
|
||||
return $this->fragment;
|
||||
}
|
||||
|
||||
public function setFragment(string $fragment): void
|
||||
{
|
||||
$this->fragment = $fragment;
|
||||
}
|
||||
|
||||
public function pageWasModified(): bool
|
||||
{
|
||||
return $this->pageWasModified;
|
||||
}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\TypoScript\AST\Node\RootNode;
|
||||
|
||||
/**
|
||||
* This event allows listeners to adjust and react on TypoScript 'config'.
|
||||
*
|
||||
* This event is dispatched *before* final TypoScript 'config' is written to cache, and
|
||||
* *not* when a page can be successfully retrieved from cache, which is typically
|
||||
* the case in 'page is fully cached' scenarios.
|
||||
*
|
||||
* This incoming $configTree has already been merged with the determined
|
||||
* PAGE "page.config" TypoScript of the requested 'type' / 'typeNum' and the global
|
||||
* TypoScript setup 'config'.
|
||||
*
|
||||
* The result of this event is available as Request attribute:
|
||||
* $request->getAttribute('frontend.typoscript')->getConfigTree(),
|
||||
* and its array variant $request->getAttribute('frontend.typoscript')->getConfigArray().
|
||||
*
|
||||
* Registered listener can *set* a modified setup config AST. Note the TypoScript AST
|
||||
* structure is still marked @internal within v13 core and may change later,
|
||||
* using the event to *write* different 'config' data is thus still a bit risky.
|
||||
*/
|
||||
final class ModifyTypoScriptConfigEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request,
|
||||
private readonly RootNode $setupTree,
|
||||
private RootNode $configTree,
|
||||
) {}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function getSetupTree(): RootNode
|
||||
{
|
||||
return $this->setupTree;
|
||||
}
|
||||
|
||||
public function getConfigTree(): RootNode
|
||||
{
|
||||
return $this->configTree;
|
||||
}
|
||||
|
||||
public function setConfigTree(RootNode $configTree): void
|
||||
{
|
||||
$this->configTree = $configTree;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use TYPO3\CMS\Core\TypoScript\AST\Node\RootNode;
|
||||
|
||||
/**
|
||||
* This event will provide listeners with the opportunity to adjust constants according to the users' requirements
|
||||
*
|
||||
* @internal This event did not stabilize yet and may change. Use at your own risk.
|
||||
* Note the TypoScript AST is also marked @internal at the moment and may change as well.
|
||||
*/
|
||||
final class ModifyTypoScriptConstantsEvent
|
||||
{
|
||||
public function __construct(
|
||||
private RootNode $constantsAst,
|
||||
) {}
|
||||
|
||||
public function getConstantsAst(): RootNode
|
||||
{
|
||||
return $this->constantsAst;
|
||||
}
|
||||
|
||||
public function setConstantsAst(RootNode $constantsAst): void
|
||||
{
|
||||
$this->constantsAst = $constantsAst;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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\Frontend\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* Event to allow listeners to disable the loading of cached page data when a page is requested.
|
||||
* Does not have any effect if caching is disabled, or if there is no cached version of a page.
|
||||
*/
|
||||
final class ShouldUseCachedPageDataIfAvailableEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ServerRequestInterface $request,
|
||||
private bool $shouldUseCachedPageData
|
||||
) {}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function shouldUseCachedPageData(): bool
|
||||
{
|
||||
return $this->shouldUseCachedPageData;
|
||||
}
|
||||
|
||||
public function setShouldUseCachedPageData(bool $shouldUseCachedPageData): void
|
||||
{
|
||||
$this->shouldUseCachedPageData = $shouldUseCachedPageData;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user