Пример #1
0
 /**
  * test inline language label
  */
 public function testAddInlineLanguageLabel()
 {
     $expectedReturnValue = 'TYPO3.lang = {"myKey":"myValue"}';
     $this->fixture->loadExtJS();
     $this->fixture->addInlineLanguageLabel('myKey', 'myValue');
     $this->fixture->enableMoveJsFromHeaderToFooter();
     $out = $this->fixture->render(\TYPO3\CMS\Core\Page\PageRenderer::PART_FOOTER);
     $this->assertContains($expectedReturnValue, $out);
 }
 /**
  * Render start page with \TYPO3\CMS\Backend\Template\DocumentTemplate and pageTitle
  *
  * @param string $pageTitle title tag of the module. Not required by default, as BE modules are shown in a frame
  * @param bool $loadExtJs specifies whether to load ExtJS library. Defaults to FALSE
  * @param bool $loadExtJsTheme whether to load ExtJS "grey" theme. Defaults to FALSE
  * @param bool $enableExtJsDebug if TRUE, debug version of ExtJS is loaded. Use this for development only
  * @param bool $loadJQuery whether to load jQuery library. Defaults to FALSE
  * @param array $includeCssFiles List of custom CSS file to be loaded
  * @param array $includeJsFiles List of custom JavaScript file to be loaded
  * @param array $addJsInlineLabels Custom labels to add to JavaScript inline labels
  * @param array $includeRequireJsModules List of RequireJS modules to be loaded
  * @param string $jQueryNamespace Store the jQuery object in a specific namespace
  * @return void
  */
 public function render($pageTitle = '', $loadExtJs = false, $loadExtJsTheme = true, $enableExtJsDebug = false, $loadJQuery = false, $includeCssFiles = null, $includeJsFiles = null, $addJsInlineLabels = null, $includeRequireJsModules = null, $jQueryNamespace = null)
 {
     if ($pageTitle) {
         $this->pageRenderer->setTitle($pageTitle);
     }
     if ($loadExtJs) {
         $this->pageRenderer->loadExtJS(true, $loadExtJsTheme);
         if ($enableExtJsDebug) {
             $this->pageRenderer->enableExtJsDebug();
         }
     }
     if ($loadJQuery) {
         $jQueryNamespace = $jQueryNamespace ?: PageRenderer::JQUERY_NAMESPACE_DEFAULT;
         $this->pageRenderer->loadJquery(null, null, $jQueryNamespace);
     }
     // Include custom CSS and JS files
     if (is_array($includeCssFiles) && count($includeCssFiles) > 0) {
         foreach ($includeCssFiles as $addCssFile) {
             $this->pageRenderer->addCssFile($addCssFile);
         }
     }
     if (is_array($includeJsFiles) && count($includeJsFiles) > 0) {
         foreach ($includeJsFiles as $addJsFile) {
             $this->pageRenderer->addJsFile($addJsFile);
         }
     }
     if (is_array($includeRequireJsModules) && count($includeRequireJsModules) > 0) {
         foreach ($includeRequireJsModules as $addRequireJsFile) {
             $this->pageRenderer->loadRequireJsModule($addRequireJsFile);
         }
     }
     // Add inline language labels
     if (is_array($addJsInlineLabels) && count($addJsInlineLabels) > 0) {
         $extensionKey = $this->controllerContext->getRequest()->getControllerExtensionKey();
         foreach ($addJsInlineLabels as $key) {
             $label = LocalizationUtility::translate($key, $extensionKey);
             $this->pageRenderer->addInlineLanguageLabel($key, $label);
         }
     }
 }