Skip to content

Commit

Permalink
#10492 Add support for module script tags to TemplateManager
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored and jardakotesovec committed Oct 24, 2024
1 parent 6882fa4 commit b4bb499
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions classes/template/PKPTemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ public function addJavaScript(string $name, string $script, array $args = []): v
'priority' => self::STYLE_SEQUENCE_NORMAL,
'contexts' => ['frontend'],
'inline' => false,
'type' => 'text/javascript',
],
$args
);
Expand All @@ -587,6 +588,7 @@ public function addJavaScript(string $name, string $script, array $args = []): v
$this->_javaScripts[$context][$args['priority']][$name] = [
'script' => $script,
'inline' => $args['inline'],
'type' => $args['type'],
];
}
}
Expand Down Expand Up @@ -2196,12 +2198,12 @@ public function smartyLoadScript($params, $smarty)
foreach ($scripts as $priorityList) {
foreach ($priorityList as $name => $data) {
if ($data['inline']) {
$output .= '<script type="text/javascript">' . $data['script'] . '</script>';
$output .= '<script type="' . $data['type'] . '">' . $data['script'] . '</script>';
} else {
if ($appVersion && strpos($data['script'], '?') === false) {
$data['script'] .= '?v=' . $appVersion;
}
$output .= '<script src="' . $data['script'] . '" type="text/javascript"></script>';
$output .= '<script src="' . $data['script'] . '" type="' . $data['type'] . '"></script>';
}
}
}
Expand Down

0 comments on commit b4bb499

Please sign in to comment.