TYPO3  7.6
PageRendererViewHelper.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Fluid\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 
20 
37 {
41  protected $pageRenderer;
42 
47  {
48  $this->pageRenderer = $pageRenderer;
49  }
50 
65  public function render($pageTitle = '', $loadExtJs = false, $loadExtJsTheme = true, $enableExtJsDebug = false, $loadJQuery = false, $includeCssFiles = null, $includeJsFiles = null, $addJsInlineLabels = null, $includeRequireJsModules = null)
66  {
67  if ($pageTitle) {
68  $this->pageRenderer->setTitle($pageTitle);
69  }
70  if ($loadExtJs) {
71  $this->pageRenderer->loadExtJS(true, $loadExtJsTheme);
72  if ($enableExtJsDebug) {
73  $this->pageRenderer->enableExtJsDebug();
74  }
75  }
76  if ($loadJQuery) {
77  $this->pageRenderer->loadJquery(null, null, PageRenderer::JQUERY_NAMESPACE_DEFAULT_NOCONFLICT);
78  }
79  // Include custom CSS and JS files
80  if (is_array($includeCssFiles) && count($includeCssFiles) > 0) {
81  foreach ($includeCssFiles as $addCssFile) {
82  $this->pageRenderer->addCssFile($addCssFile);
83  }
84  }
85  if (is_array($includeJsFiles) && count($includeJsFiles) > 0) {
86  foreach ($includeJsFiles as $addJsFile) {
87  $this->pageRenderer->addJsFile($addJsFile);
88  }
89  }
90  if (is_array($includeRequireJsModules) && count($includeRequireJsModules) > 0) {
91  foreach ($includeRequireJsModules as $addRequireJsFile) {
92  $this->pageRenderer->loadRequireJsModule($addRequireJsFile);
93  }
94  }
95  // Add inline language labels
96  if (is_array($addJsInlineLabels) && count($addJsInlineLabels) > 0) {
97  $extensionKey = $this->controllerContext->getRequest()->getControllerExtensionKey();
98  foreach ($addJsInlineLabels as $key) {
99  $label = LocalizationUtility::translate($key, $extensionKey);
100  $this->pageRenderer->addInlineLanguageLabel($key, $label);
101  }
102  }
103  }
104 }