TYPO3  7.6
fluid/Classes/ViewHelpers/Be/ContainerViewHelper.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Fluid\ViewHelpers\Be;
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 
25 
50 {
68  public function render($pageTitle = '', $enableClickMenu = true, $loadExtJs = false, $loadExtJsTheme = true, $enableExtJsDebug = false, $loadJQuery = false, $includeCssFiles = null, $includeJsFiles = null, $addJsInlineLabels = null, $includeRequireJsModules = null)
69  {
70  $pageRenderer = $this->getPageRenderer();
71  $doc = $this->getDocInstance();
72  $doc->JScode .= $doc->wrapScriptTags($doc->redirectUrls());
73 
74  // Load various standard libraries
75  if ($enableClickMenu) {
76  $doc->getContextMenuCode();
77  }
78  if ($loadExtJs) {
79  $pageRenderer->loadExtJS(true, $loadExtJsTheme);
80  if ($enableExtJsDebug) {
81  $pageRenderer->enableExtJsDebug();
82  }
83  }
84  if ($loadJQuery) {
85  $pageRenderer->loadJquery(null, null, $pageRenderer::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT);
86  }
87  // Include custom CSS and JS files
88  if (is_array($includeCssFiles) && count($includeCssFiles) > 0) {
89  foreach ($includeCssFiles as $addCssFile) {
90  $pageRenderer->addCssFile($addCssFile);
91  }
92  }
93  if (is_array($includeJsFiles) && count($includeJsFiles) > 0) {
94  foreach ($includeJsFiles as $addJsFile) {
95  $pageRenderer->addJsFile($addJsFile);
96  }
97  }
98  if (is_array($includeRequireJsModules) && count($includeRequireJsModules) > 0) {
99  foreach ($includeRequireJsModules as $addRequireJsFile) {
100  $pageRenderer->loadRequireJsModule($addRequireJsFile);
101  }
102  }
103  // Add inline language labels
104  if (is_array($addJsInlineLabels) && count($addJsInlineLabels) > 0) {
105  $extensionKey = $this->controllerContext->getRequest()->getControllerExtensionKey();
106  foreach ($addJsInlineLabels as $key) {
107  $label = LocalizationUtility::translate($key, $extensionKey);
108  $pageRenderer->addInlineLanguageLabel($key, $label);
109  }
110  }
111  // Render the content and return it
112  $output = $this->renderChildren();
113  $output = $doc->startPage($pageTitle) . $output;
114  $output .= $doc->endPage();
115  return $output;
116  }
117 }