Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TYPO3
df_tabs
Commits
4fb3e933
Commit
4fb3e933
authored
Feb 11, 2022
by
Matthias Adrowski
Browse files
[TASK] Fix possble php8.1 errors
parent
c8fd16d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Classes/Preview/PreviewRenderer.php
View file @
4fb3e933
...
...
@@ -31,6 +31,9 @@ use TYPO3\CMS\Fluid\View\StandaloneView;
*
*/
class
PreviewRenderer
implements
PreviewRendererInterface
{
public
const
RETURNTYPE_ARR
=
'array'
;
/**
* @var LanguageService $languageService
*/
...
...
@@ -82,7 +85,7 @@ class PreviewRenderer implements PreviewRendererInterface {
'T3DataStructure'
)[
'data'
][
'sDEF'
][
'lDEF'
];
$tabElements
=
GeneralUtility
::
trimExplode
(
','
,
$pluginConfiguration
[
'data'
][
'vDEF'
]
,
TRUE
);
$tabElements
=
GeneralUtility
::
trimExplode
(
','
,
$this
->
passVDefOnKeyToTemplate
(
$pluginConfiguration
,
'data'
)
,
TRUE
);
$tabs
=
[];
foreach
(
$tabElements
as
$tabElement
)
{
...
...
@@ -108,7 +111,7 @@ class PreviewRenderer implements PreviewRendererInterface {
];
}
$titles
=
GeneralUtility
::
trimExplode
(
"
\n
"
,
$pluginConfiguration
[
'titles'
][
'vDEF'
]
);
$titles
=
GeneralUtility
::
trimExplode
(
"
\n
"
,
$this
->
passVDefOnKeyToTemplate
(
$pluginConfiguration
,
'titles'
)
);
// Remove first item if it is empty to mimic what is actually saved to the DB and frontend behaviour.
// This gets done automatically on a second save of the plugin anyways but it should happen every time.
if
(
$titles
[
0
]
===
''
)
{
...
...
@@ -116,19 +119,38 @@ class PreviewRenderer implements PreviewRendererInterface {
}
$templateData
=
[
'mode'
=>
$pluginConfiguration
[
'mode'
][
'vDEF'
]
,
'mode'
=>
$this
->
passVDefOnKeyToTemplate
(
$pluginConfiguration
,
'mode'
)
,
'tabs'
=>
$tabs
,
'titles'
=>
$titles
,
'enableAutoPlay'
=>
$pluginConfiguration
[
'enableAutoPlay'
][
'vDEF'
]
,
'autoPlayInterval'
=>
$pluginConfiguration
[
'autoPlayInterval'
][
'vDEF'
]
,
'enableMouseOver'
=>
$pluginConfiguration
[
'enableMouseOver'
][
'vDEF'
]
,
'hashName'
=>
$pluginConfiguration
[
'hashName'
][
'vDEF'
]
'enableAutoPlay'
=>
$this
->
passVDefOnKeyToTemplate
(
$pluginConfiguration
,
'enableAutoPlay'
)
,
'autoPlayInterval'
=>
$this
->
passVDefOnKeyToTemplate
(
$pluginConfiguration
,
'autoPlayInterval'
)
,
'enableMouseOver'
=>
$this
->
passVDefOnKeyToTemplate
(
$pluginConfiguration
,
'enableMouseOver'
)
,
'hashName'
=>
$this
->
passVDefOnKeyToTemplate
(
$pluginConfiguration
,
'hashName'
)
];
$view
->
assign
(
'data'
,
$templateData
);
return
$view
->
render
();
}
/**
* @param array $conf
* @param string $key
* @param string $returnType
* @return array|mixed|string
*/
private
function
passVDefOnKeyToTemplate
(
array
$conf
,
string
$key
,
string
$returnType
=
''
)
{
if
(
isset
(
$conf
[
$key
]))
{
return
$conf
[
$key
][
'vDEF'
];
}
// check if we got a possible returntype:
if
(
$returnType
===
self
::
RETURNTYPE_ARR
)
{
return
[];
}
return
''
;
}
/**
* Render a footer for the record to display in page module below
* the body of the item's preview.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment