|
1
|
|
|
<?php |
|
2
|
|
|
namespace Fab\Media\Override\Backend\Form; |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* This file is part of the TYPO3 CMS project. |
|
6
|
|
|
* |
|
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
9
|
|
|
* of the License, or any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* For the full copyright and license information, please read the |
|
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
13
|
|
|
* |
|
14
|
|
|
* The TYPO3 project - inspiring people to share! |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
use Fab\Media\Module\VidiModule; |
|
18
|
|
|
use TYPO3\CMS\Backend\Utility\BackendUtility; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Class FormResultCompiler |
|
22
|
|
|
*/ |
|
23
|
|
|
class FormResultCompiler extends \TYPO3\CMS\Backend\Form\FormResultCompiler |
|
24
|
|
|
{ |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* JavaScript bottom code |
|
28
|
|
|
* |
|
29
|
|
|
* @param string $formname The identification of the form on the page. |
|
30
|
|
|
* @return string A section with JavaScript - if $update is FALSE, embedded in <script></script> |
|
31
|
|
|
*/ |
|
32
|
|
|
protected function JSbottom($formname = 'forms[0]') |
|
33
|
|
|
{ |
|
34
|
|
|
|
|
35
|
|
|
$out = parent::JSbottom($formname); |
|
36
|
|
|
|
|
37
|
|
|
$enableMediaFilePicker = (bool)$this->getBackendUser()->getTSConfigVal('options.vidi.enableMediaFilePicker'); |
|
38
|
|
|
if ($enableMediaFilePicker) { |
|
39
|
|
|
|
|
40
|
|
|
$pageRenderer = $this->getPageRenderer(); |
|
41
|
|
|
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Media/MediaFormEngine', 'function(MediaFormEngine) { |
|
42
|
|
|
MediaFormEngine.vidiModuleUrl = \'' . BackendUtility::getModuleUrl(VidiModule::getSignature()) . '\'; |
|
43
|
|
|
MediaFormEngine.vidiModulePrefix = \'' . VidiModule::getParameterPrefix() . '\'; |
|
44
|
|
|
}'); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
return $out; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Returns an instance of the current Backend User. |
|
52
|
|
|
* |
|
53
|
|
|
* @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
54
|
|
|
*/ |
|
55
|
|
|
protected function getBackendUser() |
|
|
|
|
|
|
56
|
|
|
{ |
|
57
|
|
|
return $GLOBALS['BE_USER']; |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: