1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Issue #2678 - Fix merging of theme plugin template when a key is provided.

This commit is contained in:
Cameron
2018-01-18 16:19:40 -08:00
parent fb7e9668e7
commit 3b5b64195e
3 changed files with 30 additions and 16 deletions

View File

@@ -2812,22 +2812,30 @@ class e107
$id = str_replace('/', '_', $id);
$ret = self::_getTemplate($id, $key, $reg_path, $path, $info);
if(!$merge || !$override || !is_array($ret))
if($merge === false || $override === false)
{
return $ret;
return ($ret === false) ? '' : $ret;
}
// merge
$reg_path = 'plugin/'.$plug_name.'/templates/'.$id;
$path = self::templatePath($plug_name, $id, false);
$id = str_replace('/', '_', $id);
// Introduced noWrapper when merging
$ret_plug = self::_getTemplate($id, $key, $reg_path, $path, $info, true);
if($merge === true && $key !== null && $ret === false) // key not set, so send 'core' version instead.
{
return $ret_plug;
}
if($ret === false)
{
return '';
}
return (is_array($ret_plug) ? array_merge($ret_plug, $ret) : $ret);
}
@@ -3041,12 +3049,13 @@ class e107
}
$ret = (!$info ? self::getRegistry($regPath) : self::getRegistry($regPathInfo));
if(!$key)
{
return $ret;
}
return ($ret && is_array($ret) && isset($ret[$key]) ? $ret[$key] : '');
return ($ret && is_array($ret) && isset($ret[$key]) ? $ret[$key] : false);
}
/**

View File

@@ -29,7 +29,12 @@ foreach($tmp as $id => $val)
// e107::getDebug()->log($val);
}
$template = e107::getTemplate('news', 'news_menu', 'archive');
$template = e107::getTemplate('news', 'news_menu', 'archive',true, true);
if(ADMIN && empty($template))
{
$text = "Missing Template. Check that your theme's news_menu_template.php file contains an 'archive' template. ";
}
foreach($arr as $year=>$val)
{

View File

@@ -137,7 +137,7 @@ $NEWS_MENU_TEMPLATE['archive']['year_start'] = "<li>
$NEWS_MENU_TEMPLATE['archive']['year_end'] = '</ul></li>';
$NEWS_MENU_TEMPLATE['archive']['month_start'] = "<li>
<a class='e-expandit' href='#{MONTH_ID}'>{MONTH_NAME}<span class='badge'>{MONTH_COUNT}</span></a>
<a class='e-expandit' href='#{MONTH_ID}'>{MONTH_NAME}</a>
<ul id='{MONTH_ID}' class='news-archive-menu-items' style='display:none'>
";
$NEWS_MENU_TEMPLATE['archive']['month_end'] = '</ul></li>';