From ef751041dd8c149c7c499625d0d0752ddb460374 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sat, 15 Feb 2025 21:24:06 +0900 Subject: [PATCH] Fix incorrect header script if member module uses its own layout #2474 --- classes/display/HTMLDisplayHandler.php | 11 ++++++++++- classes/module/ModuleHandler.class.php | 7 ------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index c851b09c7..e54640309 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -136,7 +136,6 @@ class HTMLDisplayHandler // compile if connected to the layout if($layout_srl > 0) { - // handle separately if the layout is faceoff if($layout_info && isset($layout_info->type) && $layout_info->type == 'faceoff') { @@ -164,6 +163,16 @@ class HTMLDisplayHandler $oTemplate = new Rhymix\Framework\Template; $output = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file); + // Add layout header script. + if ($layout_srl > 0) + { + $part_config = ModuleModel::getModulePartConfig('layout', $layout_srl); + if ($part_config && isset($part_config->header_script)) + { + Context::addHtmlHeader($part_config->header_script); + } + } + // if popup_layout, remove admin bar. $realLayoutPath = FileHandler::getRealPath($layout_path); if(substr_compare($realLayoutPath, '/', -1) !== 0) diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 95c535c3d..790cf5811 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -268,13 +268,6 @@ class ModuleHandler extends Handler // Reset layout_srl in module_info. $module_info->{$targetSrl} = $layoutSrl; - - // Add layout header script. - $part_config = ModuleModel::getModulePartConfig('layout', $layoutSrl); - if ($part_config && isset($part_config->header_script)) - { - Context::addHtmlHeader($part_config->header_script); - } } else {