TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -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\Fluid\Event;
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Component\ComponentDefinition;
|
||||
|
||||
/**
|
||||
* Event to modify the static definition of a Fluid component before the
|
||||
* definition is written to cache. The definition must not have any
|
||||
* dependencies on runtime information, such as the request.
|
||||
*/
|
||||
final class ModifyComponentDefinitionEvent
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $namespace,
|
||||
private ComponentDefinition $componentDefinition
|
||||
) {}
|
||||
|
||||
public function getNamespace(): string
|
||||
{
|
||||
return $this->namespace;
|
||||
}
|
||||
|
||||
public function getComponentDefinition(): ComponentDefinition
|
||||
{
|
||||
return $this->componentDefinition;
|
||||
}
|
||||
|
||||
public function setComponentDefinition(ComponentDefinition $componentDefinition): void
|
||||
{
|
||||
$this->componentDefinition = $componentDefinition;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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\Fluid\Event;
|
||||
|
||||
/**
|
||||
* Event to modify registered global Fluid namespaces before they
|
||||
* are passed to Fluid's ViewHelperResolver.
|
||||
*/
|
||||
final class ModifyNamespacesEvent
|
||||
{
|
||||
/**
|
||||
* @param array<string, string[]> $namespaces
|
||||
*/
|
||||
public function __construct(private array $namespaces) {}
|
||||
|
||||
/**
|
||||
* @return array<string, string[]>
|
||||
*/
|
||||
public function getNamespaces(): array
|
||||
{
|
||||
return $this->namespaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string[]> $namespaces
|
||||
*/
|
||||
public function setNamespaces(array $namespaces): void
|
||||
{
|
||||
$this->namespaces = $namespaces;
|
||||
}
|
||||
}
|
||||
@@ -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\Fluid\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\Page\ContentArea;
|
||||
|
||||
/**
|
||||
* Event to modify the rendered content area output.
|
||||
* This can be used to alter the final HTML of a content area,
|
||||
* for example to render a debug wrapper around it.
|
||||
*/
|
||||
final class ModifyRenderedContentAreaEvent
|
||||
{
|
||||
public function __construct(
|
||||
private string $renderedContentArea,
|
||||
private readonly ContentArea $contentArea,
|
||||
private readonly ServerRequestInterface $request,
|
||||
) {}
|
||||
|
||||
public function getRenderedContentArea(): string
|
||||
{
|
||||
return $this->renderedContentArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the rendered content area's HTML.
|
||||
* Make sure to return escaped content if necessary.
|
||||
*/
|
||||
public function setRenderedContentArea(string $renderedContentArea): void
|
||||
{
|
||||
$this->renderedContentArea = $renderedContentArea;
|
||||
}
|
||||
|
||||
public function getContentArea(): ContentArea
|
||||
{
|
||||
return $this->contentArea;
|
||||
}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
}
|
||||
@@ -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\Fluid\Event;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Core\Domain\RecordInterface;
|
||||
|
||||
/**
|
||||
* Event to modify the rendered record output.
|
||||
* This can be used to alter the final HTML of a record (eg. content element),
|
||||
* for example to render a debug wrapper around it.
|
||||
*/
|
||||
final class ModifyRenderedRecordEvent
|
||||
{
|
||||
public function __construct(
|
||||
private string $renderedRecord,
|
||||
private readonly RecordInterface $record,
|
||||
private readonly ServerRequestInterface $request,
|
||||
) {}
|
||||
|
||||
public function getRenderedRecord(): string
|
||||
{
|
||||
return $this->renderedRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the rendered record's HTML.
|
||||
* Make sure to return escaped content if necessary.
|
||||
*/
|
||||
public function setRenderedRecord(string $renderedRecord): void
|
||||
{
|
||||
$this->renderedRecord = $renderedRecord;
|
||||
}
|
||||
|
||||
public function getRecord(): RecordInterface
|
||||
{
|
||||
return $this->record;
|
||||
}
|
||||
|
||||
public function getRequest(): ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
}
|
||||
@@ -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\Fluid\Event;
|
||||
|
||||
use TYPO3Fluid\Fluid\Core\Component\ComponentDefinitionProviderInterface;
|
||||
use TYPO3Fluid\Fluid\Core\Component\ComponentTemplateResolverInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperResolverDelegateInterface;
|
||||
|
||||
/**
|
||||
* Event to provide additional variables to a Fluid component's template.
|
||||
* These variables should be static and must not have any dependencies on runtime
|
||||
* information, such as the request. Think of these variables as something that
|
||||
* could be provided as static autocomplete in IDEs: Prefixes based on component
|
||||
* name, global design tokens, ...
|
||||
*
|
||||
* @see RenderComponentEvent
|
||||
*/
|
||||
final class ProvideStaticVariablesToComponentEvent
|
||||
{
|
||||
/**
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
private $staticVariables = [];
|
||||
|
||||
public function __construct(
|
||||
private readonly ViewHelperResolverDelegateInterface&ComponentDefinitionProviderInterface&ComponentTemplateResolverInterface $componentCollection,
|
||||
private readonly string $viewHelperName,
|
||||
) {}
|
||||
|
||||
public function getComponentCollection(): ViewHelperResolverDelegateInterface&ComponentDefinitionProviderInterface&ComponentTemplateResolverInterface
|
||||
{
|
||||
return $this->componentCollection;
|
||||
}
|
||||
|
||||
public function getViewHelperName(): string
|
||||
{
|
||||
return $this->viewHelperName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getStaticVariables(): array
|
||||
{
|
||||
return $this->staticVariables;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $staticVariables
|
||||
*/
|
||||
public function setStaticVariables(array $staticVariables): void
|
||||
{
|
||||
$this->staticVariables = $staticVariables;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?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\Fluid\Event;
|
||||
|
||||
use Psr\EventDispatcher\StoppableEventInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3Fluid\Fluid\Core\Component\ComponentDefinitionProviderInterface;
|
||||
use TYPO3Fluid\Fluid\Core\Component\ComponentTemplateResolverInterface;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperResolverDelegateInterface;
|
||||
|
||||
/**
|
||||
* Event to modify/replace the rendering behavior of Fluid components.
|
||||
* This can be used both to take over the whole rendering (by filling the
|
||||
* $renderedContent property) and to introduce side effects while leaving
|
||||
* the default rendering intact, like for embedding related frontent assets
|
||||
* automatically. Also, both arguments and slots can be altered.
|
||||
*
|
||||
* The event chain stops with the first listener that takes over the
|
||||
* rendering completely. If no listener stops the chain, Fluid's default
|
||||
* component rendering will be triggered afterwards.
|
||||
*
|
||||
* Note that the provided parentRenderingContext must not be used to
|
||||
* render child templates as this might have side effects on the parent
|
||||
* template. Instead, a new rendering context (or a clone of the parent)
|
||||
* must be used.
|
||||
*
|
||||
* @see \TYPO3Fluid\Fluid\Core\Component\ComponentRenderer
|
||||
*/
|
||||
final class RenderComponentEvent implements StoppableEventInterface
|
||||
{
|
||||
private ?string $renderedComponent = null;
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $arguments
|
||||
* @param array<string, callable> $slots
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly ViewHelperResolverDelegateInterface&ComponentDefinitionProviderInterface&ComponentTemplateResolverInterface $componentCollection,
|
||||
private readonly string $viewHelperName,
|
||||
private array $arguments,
|
||||
private array $slots,
|
||||
private readonly RenderingContextInterface $parentRenderingContext,
|
||||
private readonly ?ServerRequestInterface $request,
|
||||
) {}
|
||||
|
||||
public function getComponentCollection(): ViewHelperResolverDelegateInterface&ComponentDefinitionProviderInterface&ComponentTemplateResolverInterface
|
||||
{
|
||||
return $this->componentCollection;
|
||||
}
|
||||
|
||||
public function getViewHelperName(): string
|
||||
{
|
||||
return $this->viewHelperName;
|
||||
}
|
||||
|
||||
public function getParentRenderingContext(): RenderingContextInterface
|
||||
{
|
||||
return $this->parentRenderingContext;
|
||||
}
|
||||
|
||||
public function getRequest(): ?ServerRequestInterface
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getArguments(): array
|
||||
{
|
||||
return $this->arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $arguments
|
||||
*/
|
||||
public function setArguments(array $arguments): void
|
||||
{
|
||||
$this->arguments = $arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, callable>
|
||||
*/
|
||||
public function getSlots(): array
|
||||
{
|
||||
return $this->slots;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, callable> $slots
|
||||
*/
|
||||
public function setSlots(array $slots): void
|
||||
{
|
||||
$this->slots = $slots;
|
||||
}
|
||||
|
||||
public function setRenderedComponent(string $renderedComponent): void
|
||||
{
|
||||
$this->renderedComponent = $renderedComponent;
|
||||
}
|
||||
|
||||
public function getRenderedComponent(): ?string
|
||||
{
|
||||
return $this->renderedComponent;
|
||||
}
|
||||
|
||||
public function isPropagationStopped(): bool
|
||||
{
|
||||
return $this->renderedComponent !== null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user