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