[TASK] Deprecate DocumentTemplate methods
[Packages/TYPO3.CMS.git] / typo3 / sysext / filelist / Classes / ViewHelpers / Be / ContainerViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Filelist\ViewHelpers\Be;
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 TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 /**
20 * View helper which allows you to create extbase based modules in the style of TYPO3 default modules.
21 *
22 * = Examples =
23 *
24 * <code title="Simple">
25 * <f:be.container>your module content</f:be.container>
26 * </code>
27 * <output>
28 * "your module content" wrapped with proper head & body tags.
29 * Default backend CSS styles and JavaScript will be included
30 * </output>
31 *
32 * <code title="All options">
33 * <f:be.container pageTitle="foo" enableClickMenu="false" loadExtJs="true" loadExtJsTheme="false" extJsAdapter="jQuery" enableExtJsDebug="true" loadJQuery="true" includeCssFiles="{0: '{f:uri.resource(path:\'Css/Styles.css\')}'}" includeJsFiles="{0: '{f:uri.resource(path:\'JavaScript/Library1.js\')}', 1: '{f:uri.resource(path:\'JavaScript/Library2.js\')}'}" addJsInlineLabels="{0: 'label1', 1: 'label2'}">your module content</f:be.container>
34 * </code>
35 * <output>
36 * "your module content" wrapped with proper head & body tags.
37 * Custom CSS file EXT:your_extension/Resources/Public/Css/styles.css and
38 * JavaScript files EXT:your_extension/Resources/Public/JavaScript/Library1.js and EXT:your_extension/Resources/Public/JavaScript/Library2.js
39 * will be loaded, plus ExtJS and jQuery and some inline labels for usage in JS code.
40 * </output>
41 */
42 class ContainerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\ContainerViewHelper
43 {
44 /**
45 * Render start page with \TYPO3\CMS\Backend\Template\DocumentTemplate and pageTitle
46 *
47 * @param string $pageTitle title tag of the module. Not required by default, as BE modules are shown in a frame
48 * @param bool $enableClickMenu If TRUE, loads clickmenu.js required by BE context menus. Defaults to TRUE
49 * @param bool $loadExtJs specifies whether to load ExtJS library. Defaults to FALSE
50 * @param bool $loadExtJsTheme whether to load ExtJS "grey" theme. Defaults to FALSE
51 * @param bool $enableExtJsDebug if TRUE, debug version of ExtJS is loaded. Use this for development only
52 * @param bool $loadJQuery whether to load jQuery library. Defaults to FALSE
53 * @param array $includeCssFiles List of custom CSS file to be loaded
54 * @param array $includeJsFiles List of custom JavaScript file to be loaded
55 * @param array $addJsInlineLabels Custom labels to add to JavaScript inline labels
56 * @param array $includeRequireJsModules List of RequireJS modules to be loaded
57 * @param array $addJsInlineLabelFiles List of files containing custom labels to add to JavaScript inline labels
58 * @param string $addJsInline Custom inline JavaScript
59 * @return string
60 * @see \TYPO3\CMS\Backend\Template\DocumentTemplate
61 * @see \TYPO3\CMS\Core\Page\PageRenderer
62 */
63 public function render($pageTitle = '', $enableClickMenu = true, $loadExtJs = false, $loadExtJsTheme = true, $enableExtJsDebug = false, $loadJQuery = false, $includeCssFiles = null, $includeJsFiles = null, $addJsInlineLabels = null, $includeRequireJsModules = null, $addJsInlineLabelFiles = null, $addJsInline = null)
64 {
65 if (is_array($addJsInlineLabelFiles)) {
66 foreach ($addJsInlineLabelFiles as $addJsInlineLabelFile) {
67 $this->getPageRenderer()->addInlineLanguageLabelFile($addJsInlineLabelFile['file'], $addJsInlineLabelFile['prefix']);
68 }
69 }
70
71 $content = parent::render($pageTitle, $enableClickMenu, $loadExtJs, $loadExtJsTheme, $enableExtJsDebug, $loadJQuery, $includeCssFiles, $includeJsFiles, $addJsInlineLabels, $includeRequireJsModules);
72
73 $doc = $this->getDocInstance();
74 $doc->JScode .= GeneralUtility::wrapJS($addJsInline);
75 return $doc->insertStylesAndJS($content);
76 }
77 }