Commit dd91a386 authored by Josef Glatz's avatar Josef Glatz
Browse files

[BUGFIX] Fix InlineLanguageLabelsViewHelper

Use `\TYPO3\CMS\Core\Page\PageRenderer::addJsInlineCode`
for adding inline javascript code
parent 19743fdf
......@@ -45,7 +45,7 @@ class InlineLanguageLabelsViewHelper extends AbstractViewHelper {
*
* @param string $labels Comma separated list of label keys to include
* @param boolean $htmlEscape
* @return string
* @return void
*/
public function render($labels = '', $htmlEscape = FALSE) {
$extensionName = $this->controllerContext->getRequest()->getControllerExtensionName();
......@@ -57,17 +57,17 @@ class InlineLanguageLabelsViewHelper extends AbstractViewHelper {
$languageArray[$key] = ($htmlEscape ? htmlentities($value) : $value);
}
return '
<script type="text/javascript">
var AY = AY || {};
$javascriptCode = '
var AY = AY || {};
AY.lang = AY.lang || {};
AY.lang.' . $extensionName . ' = AY.lang.' . $extensionName . ' || {};
var languageLabels = ' . json_encode($languageArray) . ';
for (label in languageLabels) {
AY.lang.' . $extensionName . '[label] = languageLabels[label];
}
</script>
';
$this->getPageRenderer()->addJsInlineCode($extensionName, $javascriptCode);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment