5a0e829caf67f89e54b28c5f85f7e9afff5c59fc
[Packages/TYPO3.CMS.git] / typo3 / sysext / filelist / Classes / ViewHelpers / Be / ContainerViewHelper.php
1 <?php
2 /*
3 * This file is part of the TYPO3 CMS project.
4 *
5 * It is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License, either version 2
7 * of the License, or any later version.
8 *
9 * For the full copyright and license information, please read the
10 * LICENSE.txt file that was distributed with this source code.
11 *
12 * The TYPO3 project - inspiring people to share!
13 */
14 namespace TYPO3\CMS\Filelist\ViewHelpers\Be;
15
16 /**
17 * View helper which allows you to create extbase based modules in the style of TYPO3 default modules.
18 *
19 * = Examples =
20 *
21 * <code title="Simple">
22 * <f:be.container>your module content</f:be.container>
23 * </code>
24 * <output>
25 * "your module content" wrapped with proper head & body tags.
26 * Default backend CSS styles and JavaScript will be included
27 * </output>
28 *
29 * <code title="All options">
30 * <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>
31 * </code>
32 * <output>
33 * "your module content" wrapped with proper head & body tags.
34 * Custom CSS file EXT:your_extension/Resources/Public/Css/styles.css and
35 * JavaScript files EXT:your_extension/Resources/Public/JavaScript/Library1.js and EXT:your_extension/Resources/Public/JavaScript/Library2.js
36 * will be loaded, plus ExtJS and jQuery and some inline labels for usage in JS code.
37 * </output>
38 */
39 class ContainerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\ContainerViewHelper
40 {
41 /**
42 * Render start page with \TYPO3\CMS\Backend\Template\DocumentTemplate and pageTitle
43 *
44 * @param string $pageTitle title tag of the module. Not required by default, as BE modules are shown in a frame
45 * @param bool $enableClickMenu If TRUE, loads clickmenu.js required by BE context menus. Defaults to TRUE
46 * @param bool $loadExtJs specifies whether to load ExtJS library. Defaults to FALSE
47 * @param bool $loadExtJsTheme whether to load ExtJS "grey" theme. Defaults to FALSE
48 * @param bool $enableExtJsDebug if TRUE, debug version of ExtJS is loaded. Use this for development only
49 * @param bool $loadJQuery whether to load jQuery library. Defaults to FALSE
50 * @param array $includeCssFiles List of custom CSS file to be loaded
51 * @param array $includeJsFiles List of custom JavaScript file to be loaded
52 * @param array $addJsInlineLabels Custom labels to add to JavaScript inline labels
53 * @param array $includeRequireJsModules List of RequireJS modules to be loaded
54 * @param array $addJsInlineLabelFiles List of files containing custom labels to add to JavaScript inline labels
55 * @param string $addJsInline Custom inline JavaScript
56 * @return string
57 * @see \TYPO3\CMS\Backend\Template\DocumentTemplate
58 * @see \TYPO3\CMS\Core\Page\PageRenderer
59 */
60 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)
61 {
62 if (is_array($addJsInlineLabelFiles)) {
63 foreach ($addJsInlineLabelFiles as $addJsInlineLabelFile) {
64 $this->getPageRenderer()->addInlineLanguageLabelFile($addJsInlineLabelFile['file'], $addJsInlineLabelFile['prefix']);
65 }
66 }
67
68 $content = parent::render($pageTitle, $enableClickMenu, $loadExtJs, $loadExtJsTheme, $enableExtJsDebug, $loadJQuery, $includeCssFiles, $includeJsFiles, $addJsInlineLabels, $includeRequireJsModules);
69
70 $doc = $this->getDocInstance();
71 $doc->JScode .= $doc->wrapScriptTags($addJsInline);
72 return $doc->insertStylesAndJS($content);
73 }
74 }