TYPO3 CMS  TYPO3_6-2
ContainerViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * *
12  * This script is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
14  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
15  * General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU Lesser General Public *
18  * License along with the script. *
19  * If not, see http://www.gnu.org/licenses/lgpl.html *
20  * *
21  * The TYPO3 project - inspiring people to share! *
22  * */
23 
24 use \TYPO3\CMS\Core\Utility\GeneralUtility;
25 
50 
75  public function render($pageTitle = '', $enableJumpToUrl = TRUE, $enableClickMenu = TRUE, $loadPrototype = TRUE, $loadScriptaculous = FALSE, $scriptaculousModule = '', $loadExtJs = FALSE, $loadExtJsTheme = TRUE, $extJsAdapter = '', $enableExtJsDebug = FALSE, $addCssFile = NULL, $addJsFile = NULL, $loadJQuery = FALSE, $includeCssFiles = NULL, $includeJsFiles = NULL, $addJsInlineLabels = NULL, $includeCsh = TRUE) {
76  $doc = $this->getDocInstance();
77  $pageRenderer = $doc->getPageRenderer();
78  $doc->JScode .= $doc->wrapScriptTags($doc->redirectUrls());
79 
80  // Load various standard libraries
81  if ($enableClickMenu) {
82  $doc->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/clickmenu.js');
83  }
84  if ($loadPrototype) {
85  $pageRenderer->loadPrototype();
86  }
87  if ($loadScriptaculous) {
88  $pageRenderer->loadScriptaculous($scriptaculousModule);
89  }
90  if ($loadExtJs) {
91  $pageRenderer->loadExtJS(TRUE, $loadExtJsTheme, $extJsAdapter);
92  if ($enableExtJsDebug) {
93  $pageRenderer->enableExtJsDebug();
94  }
95  }
96  if ($loadJQuery) {
97  $pageRenderer->loadJquery(NULL, NULL, $pageRenderer::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT);
98  }
99  // This way of adding a single CSS or JS file is deprecated, the array below should be used instead
100  if ($addCssFile !== NULL) {
101  GeneralUtility::deprecationLog('Usage of addCssFile attribute is deprecated since TYPO3 CMS 6.2. It will be removed in TYPO3 CMS 7.0. Use includeCssFiles instead.');
102  $pageRenderer->addCssFile($addCssFile);
103  }
104  if ($addJsFile !== NULL) {
105  GeneralUtility::deprecationLog('Usage of addJsFile attribute is deprecated since TYPO3 CMS 6.2. It will be removed in TYPO3 CMS 7.0. Use includeJsFiles instead.');
106  $pageRenderer->addJsFile($addJsFile);
107  }
108  // Include custom CSS and JS files
109  if (is_array($includeCssFiles) && count($includeCssFiles) > 0) {
110  foreach ($includeCssFiles as $addCssFile) {
111  $pageRenderer->addCssFile($addCssFile);
112  }
113  }
114  if (is_array($includeJsFiles) && count($includeJsFiles) > 0) {
115  foreach ($includeJsFiles as $addJsFile) {
116  $pageRenderer->addJsFile($addJsFile);
117  }
118  }
119  // Add inline language labels
120  if (is_array($addJsInlineLabels) && count($addJsInlineLabels) > 0) {
121  $extensionKey = $this->controllerContext->getRequest()->getControllerExtensionKey();
122  foreach ($addJsInlineLabels as $key) {
123  $label = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, $extensionKey);
124  $pageRenderer->addInlineLanguageLabel($key, $label);
125  }
126  }
127  // Render the content and return it
128  $output = $this->renderChildren();
129  $output = $doc->startPage($pageTitle, $includeCsh) . $output;
130  $output .= $doc->endPage();
131  return $output;
132  }
133 }
static translate($key, $extensionName, $arguments=NULL)
render($pageTitle='', $enableJumpToUrl=TRUE, $enableClickMenu=TRUE, $loadPrototype=TRUE, $loadScriptaculous=FALSE, $scriptaculousModule='', $loadExtJs=FALSE, $loadExtJsTheme=TRUE, $extJsAdapter='', $enableExtJsDebug=FALSE, $addCssFile=NULL, $addJsFile=NULL, $loadJQuery=FALSE, $includeCssFiles=NULL, $includeJsFiles=NULL, $addJsInlineLabels=NULL, $includeCsh=TRUE)