|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AOE\HappyFeet\Service; |
|
4
|
|
|
|
|
5
|
|
|
/*************************************************************** |
|
6
|
|
|
* Copyright notice |
|
7
|
|
|
* |
|
8
|
|
|
* (c) 2020 AOE GmbH <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* All rights reserved |
|
11
|
|
|
* |
|
12
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
|
13
|
|
|
* free software; you can redistribute it and/or modify |
|
14
|
|
|
* it under the terms of the GNU General Public License as published by |
|
15
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
16
|
|
|
* (at your option) any later version. |
|
17
|
|
|
* |
|
18
|
|
|
* The GNU General Public License can be found at |
|
19
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
|
20
|
|
|
* |
|
21
|
|
|
* This script is distributed in the hope that it will be useful, |
|
22
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
24
|
|
|
* GNU General Public License for more details. |
|
25
|
|
|
* |
|
26
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
|
27
|
|
|
***************************************************************/ |
|
28
|
|
|
|
|
29
|
|
|
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Render Footnotes for FCE |
|
33
|
|
|
*/ |
|
34
|
|
|
class FCEFootnoteService |
|
35
|
|
|
{ |
|
36
|
|
|
public ?ContentObjectRenderer $cObj = null; |
|
37
|
|
|
|
|
38
|
3 |
|
public function __construct( |
|
39
|
|
|
private RenderingService $renderingService |
|
40
|
|
|
) { |
|
41
|
3 |
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @param array $conf optional (this will be automatically set, of this method is called via 'TYPOSCRIPT-userFunc') |
|
45
|
|
|
* @return ?string The wrapped index value |
|
46
|
|
|
*/ |
|
47
|
3 |
|
public function renderItemList(string $content, array $conf = []): ?string |
|
|
|
|
|
|
48
|
|
|
{ |
|
49
|
3 |
|
if (!array_key_exists('userFunc', $conf) || !array_key_exists('field', $conf)) { |
|
50
|
1 |
|
return ''; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
2 |
|
if (array_key_exists('isGridElement', $conf) && (bool) $conf['isGridElement']) { |
|
54
|
|
|
$footnoteUids = $this->getCObj() |
|
55
|
|
|
->data['pi_flexform']['data']['sDEF']['lDEF'][$conf['field']]['vDEF']; |
|
56
|
|
|
} else { |
|
57
|
2 |
|
$footnoteUids = $this->getCObj() |
|
58
|
2 |
|
->getCurrentVal(); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
2 |
|
if (empty($footnoteUids)) { |
|
62
|
1 |
|
return ''; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
1 |
|
return $this->renderingService->renderFootnotes(explode(',', $footnoteUids)); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
1 |
|
public function setCObj(ContentObjectRenderer $cObj): void |
|
69
|
|
|
{ |
|
70
|
1 |
|
$this->cObj = $cObj; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
1 |
|
protected function getCObj(): ContentObjectRenderer |
|
74
|
|
|
{ |
|
75
|
1 |
|
return $this->cObj; |
|
|
|
|
|
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.