Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_youtube
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_youtube
Commits
d66a437e
Commit
d66a437e
authored
1 year ago
by
Georgi
Browse files
Options
Downloads
Patches
Plain Diff
[BUGFIX] Remove unused PreviewRenderer EventListener
parent
62a471ee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Classes/EventListener/PluginRenderer.php
+0
-112
0 additions, 112 deletions
Classes/EventListener/PluginRenderer.php
Configuration/Services.yaml
+0
-7
0 additions, 7 deletions
Configuration/Services.yaml
with
0 additions
and
119 deletions
Classes/EventListener/PluginRenderer.php
deleted
100644 → 0
+
0
−
112
View file @
62a471ee
<?php
/***************************************************************
* Copyright notice
* (c) sgalinski Internet Services (https://www.sgalinski.de)
* All rights reserved
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
namespace
SGalinski\SgYoutube\EventListener
;
use
SGalinski\SgYoutube\Preview\PreviewService
;
use
TYPO3\CMS\Backend\Utility\BackendUtility
;
use
TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent
;
use
TYPO3\CMS\Core\Localization\LanguageService
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
class
PluginRenderer
{
/**
* @var \SGalinski\SgYoutube\Preview\PreviewService
*/
private
PreviewService
$previewService
;
public
function
__construct
()
{
$this
->
previewService
=
GeneralUtility
::
makeInstance
(
PreviewService
::
class
);
}
public
function
__invoke
(
PageContentPreviewRenderingEvent
$event
)
{
$a
=
'a'
;
}
/**
* Preprocesses the preview rendering of a content element of type "sg_youtube"
*
* @param PageLayoutView $parentObject Calling parent object
* @param bool $drawItem Whether to draw the item using the default functionality
* @param string $headerContent Header content
* @param string $itemContent Item content
* @param array $row Record row of tt_content
* @return void
* @noinspection ReferencingObjectsInspection
* @deprecated All of this class will be removed when TYPO3 10 support is dropped
*/
public
function
preProcess
(
PageLayoutView
&
$parentObject
,
&
$drawItem
,
&
$headerContent
,
&
$itemContent
,
array
&
$row
)
:
void
{
trigger_error
(
'Using the old style of rendering backend previews is deprecated and will not longer work when TYPO3 10'
.
' support is dropped! Please switch to using the Fluid Based Page Module instead!'
,
E_USER_DEPRECATED
);
if
(
$row
[
'list_type'
]
===
'sgyoutube_youtube'
)
{
$drawItem
=
FALSE
;
$this
->
adaptPluginHeaderContent
(
$headerContent
,
$row
);
$view
=
$this
->
previewService
->
getPluginPreview
(
$row
);
$itemContent
.
=
$view
->
render
();
}
}
/**
* Adapts the given $headerContent.
* To be used in all plugin previews so the Header Contents appear similarly.
*
* @param string $headerContent
* @param array $row
*/
protected
function
adaptPluginHeaderContent
(
&
$headerContent
,
$row
)
:
void
{
$headerContent
=
'<h4>'
.
$this
->
getPluginNameForHeaderContent
(
(
int
)
$row
[
'pid'
],
$row
[
'list_type'
]
)
.
$headerContent
.
'</h4>'
;
}
/**
* Finds the label of the given $listType element on the page with the given $pid
* and returns it wrapped for use in the backend preview's header content.
*
* @param int $pid
* @param string $listType
* @return string
*/
protected
function
getPluginNameForHeaderContent
(
int
$pid
,
string
$listType
):
string
{
$languageService
=
GeneralUtility
::
makeInstance
(
LanguageService
::
class
);
$pluginName
=
$languageService
->
sL
(
BackendUtility
::
getLabelFromItemListMerged
(
$pid
,
'tt_content'
,
'list_type'
,
$listType
)
);
return
'<span class="label label-primary">'
.
$pluginName
.
'</span> '
;
}
}
This diff is collapsed.
Click to expand it.
Configuration/Services.yaml
+
0
−
7
View file @
d66a437e
...
...
@@ -25,10 +25,3 @@ services:
SGalinski\SgYoutube\Form\Element\LicenceStatus
:
autowire
:
false
autoconfigure
:
false
SGalinski\SgYoutube\EventListener\PluginRenderer
:
autowire
:
true
tags
:
-
name
:
event.listener
identifier
:
'
sgYoutubePluginRenderer'
event
:
TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment