TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -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\Core\View;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* An optional addition to ViewInterface that allows getting a PSR-7 Response directly.
|
||||
*/
|
||||
interface ResponsableViewInterface
|
||||
{
|
||||
/**
|
||||
* Renders the view and creates a response from it. Optionally receives a template location.
|
||||
*/
|
||||
public function renderResponse(string $templateFileName = ''): ResponseInterface;
|
||||
}
|
||||
@@ -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\Core\View;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
/**
|
||||
* A data object hand over to ViewFactoryInterface to create,
|
||||
* configure and return a view based on this data.
|
||||
*
|
||||
* Best practices:
|
||||
* * Hand over request if possible.
|
||||
* * Use the tuple $templateRootPaths, $partialRootPaths and $layoutRootPaths if possible, using
|
||||
* an array of "base" paths like 'EXT:Resources/Private/(Templates|Partials|Layouts)'
|
||||
* * Avoid $templatePathAndFilename
|
||||
* * Call render('path/within/templateRootPath') without file-ending on the returned ViewInterface instance.
|
||||
*/
|
||||
final readonly class ViewFactoryData
|
||||
{
|
||||
public function __construct(
|
||||
public ?array $templateRootPaths = null,
|
||||
public ?array $partialRootPaths = null,
|
||||
public ?array $layoutRootPaths = null,
|
||||
public ?string $templatePathAndFilename = null,
|
||||
public ?ServerRequestInterface $request = null,
|
||||
public ?string $format = null,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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\View;
|
||||
|
||||
/**
|
||||
* Generic TYPO3 view factory - the V in MVC.
|
||||
*
|
||||
* This interface is used in TYPO3 and should be used via dependency
|
||||
* injection to create a view instance in custom TYPO3 extensions
|
||||
* whenever a view should be rendered.
|
||||
*/
|
||||
interface ViewFactoryInterface
|
||||
{
|
||||
public function create(ViewFactoryData $data): ViewInterface;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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\View;
|
||||
|
||||
/**
|
||||
* A generic view interface.
|
||||
*/
|
||||
interface ViewInterface
|
||||
{
|
||||
/**
|
||||
* Add a variable to the view data collection.
|
||||
*/
|
||||
public function assign(string $key, mixed $value): self;
|
||||
|
||||
/**
|
||||
* Add multiple variables to the view data collection.
|
||||
*
|
||||
* @param array<string, mixed> $values Array of string keys with mixed-type values.
|
||||
*/
|
||||
public function assignMultiple(array $values): self;
|
||||
|
||||
/**
|
||||
* Renders the view. Optionally receives a template location.
|
||||
*/
|
||||
public function render(string $templateFileName = ''): string;
|
||||
}
|
||||
Reference in New Issue
Block a user