|
1
|
|
|
<?php |
|
2
|
|
|
namespace Kitodo\Dlf\Hooks; |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* (c) Kitodo. Key to digital objects e.V. <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* This file is part of the Kitodo and TYPO3 projects. |
|
8
|
|
|
* |
|
9
|
|
|
* @license GNU General Public License version 3 or later. |
|
10
|
|
|
* For the full copyright and license information, please read the |
|
11
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
use Kitodo\Dlf\Common\Helper; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Hooks and helper for \TYPO3\CMS\Core\Utility\ExtensionManagementUtility |
|
18
|
|
|
* |
|
19
|
|
|
* @author Sebastian Meyer <[email protected]> |
|
20
|
|
|
* @package TYPO3 |
|
21
|
|
|
* @subpackage dlf |
|
22
|
|
|
* @access public |
|
23
|
|
|
*/ |
|
24
|
|
|
class ExtensionManagementUtility extends \TYPO3\CMS\Core\Utility\ExtensionManagementUtility { |
|
25
|
|
|
/** |
|
26
|
|
|
* Add plugin to static template for css_styled_content |
|
27
|
|
|
* @see \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43() |
|
28
|
|
|
* |
|
29
|
|
|
* @access public |
|
30
|
|
|
* |
|
31
|
|
|
* @param string $key: The extension key |
|
32
|
|
|
* @param string $class: The qualified class name |
|
33
|
|
|
* @param string $suffix: The uid of the record |
|
34
|
|
|
* @param string $type: Determines the type of the frontend plugin |
|
35
|
|
|
* @param boolean $cached: Should we created a USER object instead of USER_INT? |
|
36
|
|
|
* |
|
37
|
|
|
* @return void |
|
38
|
|
|
*/ |
|
39
|
|
|
public static function addPItoST43($key, $class, $suffix = '', $type = 'list_type', $cached = FALSE) { |
|
40
|
|
|
$internalName = 'tx_'.$key.'_'.strtolower(Helper::getUnqualifiedClassName($class)); |
|
41
|
|
|
// General plugin |
|
42
|
|
|
$typoscript = 'plugin.'.$internalName.' = USER'.($cached ? '' : '_INT')."\n"; |
|
43
|
|
|
$typoscript .= 'plugin.'.$internalName.'.userFunc = '.$class.'->main'."\n"; |
|
44
|
|
|
parent::addTypoScript($key, 'setup', $typoscript); |
|
45
|
|
|
// Add after defaultContentRendering |
|
46
|
|
|
switch ($type) { |
|
47
|
|
|
case 'list_type': |
|
48
|
|
|
$addLine = 'tt_content.list.20.'.$key.$suffix.' = < plugin.'.$internalName; |
|
49
|
|
|
break; |
|
50
|
|
|
default: |
|
51
|
|
|
$addLine = ''; |
|
52
|
|
|
} |
|
53
|
|
|
if ($addLine) { |
|
54
|
|
|
parent::addTypoScript($key, 'setup', $addLine, 'defaultContentRendering'); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|