Commit 8660a5bb authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn
Browse files

[TASK] Clean up unused code from PreviewRenderer pattern

The PreviewRenderer pattern was added very late in
v10 development, along with a Resolver concept,
which was never properly implemented and registered.

The non-required code is now removed along
with the invalid documentation.

Resolves: #98376
Releases: main
Change-Id: Ife6b5a893f753573928d60f51439264007ddcee4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75780


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent edf20a9a
<?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\Backend\Preview;
/**
* Interface PreviewRendererResolverInterface
*
* Contract for classes capable of resolving PreviewRenderInterface
* implementations based on table and record.
*/
interface PreviewRendererResolverInterface
{
/**
* @param string $table The name of the table the returned PreviewRenderer must work with
* @param array $row A record from $table which will be previewed - allows returning a different PreviewRenderer based on record attributes
* @param int $pageUid The UID of the page on which the preview will be rendered - allows returning a different PreviewRenderer based on for example pageTSconfig
* @return PreviewRendererInterface
*/
public function resolveRendererFor(string $table, array $row, int $pageUid): PreviewRendererInterface;
}
......@@ -20,9 +20,6 @@ namespace TYPO3\CMS\Backend\Preview;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class StandardPreviewRendererResolver
*
* Default implementation of PreviewRendererResolverInterface.
* Scans TCA configuration to detect:
*
* - TCA.$table.types.$typeFromTypeField.previewRenderer
......@@ -31,7 +28,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
* Depending on which one is defined and checking the first, type-specific
* variant first.
*/
class StandardPreviewRendererResolver implements PreviewRendererResolverInterface
class StandardPreviewRendererResolver
{
/**
* @param string $table The name of the table the returned PreviewRenderer must work with
......
......@@ -4,7 +4,6 @@ declare(strict_types=1);
use TYPO3\CMS\Backend\Backend\Avatar\DefaultAvatarProvider;
use TYPO3\CMS\Backend\LoginProvider\UsernamePasswordLoginProvider;
use TYPO3\CMS\Backend\Preview\StandardPreviewRendererResolver;
use TYPO3\CMS\Backend\Provider\PageTsBackendLayoutDataProvider;
use TYPO3\CMS\Backend\Security\EmailLoginNotification;
use TYPO3\CMS\Backend\Security\FailedLoginAttemptNotification;
......@@ -25,11 +24,6 @@ $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['avatarProviders']['defaultAva
// Register search key shortcuts
$GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['page'] = 'pages';
// Register standard preview renderer resolver implementation.
// Resolves PreviewRendererInterface implementations for a given table and record.
// Can be replaced with custom implementation by overriding this value in extensions.
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['previewRendererResolver'] = StandardPreviewRendererResolver::class;
// Register BackendLayoutDataProvider for PageTs
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['BackendLayoutDataProvider']['pagets'] = PageTsBackendLayoutDataProvider::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['backendUserLogin']['sendEmailOnLogin'] = EmailLoginNotification::class . '->emailAtLogin';
......
......@@ -51,17 +51,6 @@ The feature adds two new concepts:
Configuring the implementation
------------------------------
The PreviewRendererResolver can be overridden by setting:
.. code-block:: php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['previewRendererResolver'] = \TYPO3\CMS\Backend\Preview\StandardPreviewRendererResolver::class;
The class shown is the standard implementation TYPO3 provides. Inspect this class for further developer information.
Once overridden, the old resolver will no longer be consulted.
Individual preview renderers can be defined by using one of the following two approaches:
.. code-block:: php
......@@ -99,10 +88,6 @@ type of plugin you want to target is selected as plugin type.
The PreviewRenderer interface
-----------------------------
:php:`\TYPO3\CMS\Backend\Preview\PreviewRendererResolverInterface` must be implemented by :php:`PreviewRendererResolvers` and
contains a single API method, :php:`public function resolveRendererFor($table, array $row, int $pageUid);` which
unsurprisingly returns a single :php:`PreviewRenderer` based on the given input.
:php:`\TYPO3\CMS\Backend\Preview\PreviewRendererInterface` must be implemented by any :php:`PreviewRenderer` and contains some
API methods:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment