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 committed Oct 2, 2024
1 parent ae219f5 commit a5ffc93
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions classes/template/PKPTemplateManager.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ function addJavaScript($name, $script, $args = []) {
'priority' => STYLE_SEQUENCE_NORMAL,
'contexts' => ['frontend'],
'inline' => false,
'type' => 'text/javascript',
],
$args
);
Expand All @@ -521,6 +522,7 @@ function addJavaScript($name, $script, $args = []) {
$this->_javaScripts[$context][$args['priority']][$name] = [
'script' => $script,
'inline' => $args['inline'],
'type' => $args['type'],
];
}
}
Expand Down Expand Up @@ -2027,12 +2029,12 @@ 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 a5ffc93

Please sign in to comment.