1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Theme config can now use plugin $fields markup and save prefs to own table.

This commit is contained in:
Cameron
2017-01-01 16:27:48 -08:00
parent 85895b825b
commit c8d3cfec8a
2 changed files with 30 additions and 9 deletions

View File

@@ -963,9 +963,12 @@ class themeHandler
$legacyConfile = e_THEME.$this->id."/".$this->id."_config.php"; // @Deprecated
$newConfig = false;
if(is_readable($newConfile))
{
$confile = $newConfile;
$newConfig = true;
}
elseif(is_readable($legacyConfile))// TODO Eventually remove it.
{
@@ -982,7 +985,7 @@ class themeHandler
{
$mes->addDebug("Loading : ".$confile);
include ($confile);
$className = 'theme_'.$this->id;
$className = ($newConfig === true) ? 'theme_config' : 'theme_'.$this->id;
if(class_exists($className))
{
$this->themeConfigObj = new $className();
@@ -1000,20 +1003,36 @@ class themeHandler
{
$mes = e107::getMessage();
$mes->addDebug(TPVLAN_87);
$frm = e107::getForm();
$mes->addDebug("Rendering Theme Config");
$this->loadThemeConfig();
$value = e107::getThemeConfig('landingzero')->getPref();
if($this->themeConfigObj)
{
$var = call_user_func(array(&$this->themeConfigObj, 'config'));
vartrue($text); // avoid notice
$text = ''; // avoid notice
foreach ($var as $val)
foreach ($var as $field=>$val)
{
if(is_numeric($field))
{
$text .= "<tr><td><b>".$val['caption']."</b>:</td><td colspan='2'>".$val['html']."<div class='field-help'>".$val['help']."</div>
</td></tr>";
}
else
{
if(!empty($v['multilan']) && isset($value[$field][e_LANGUAGE]))
{
$value[$field] = varset($value[$field][e_LANGUAGE],'');
}
$text .= "<tr><td><b>".$val['title']."</b>:</td><td colspan='2'>".$frm->renderElement($field, $value[$field], $val)."<div class='field-help'>".$val['help']."</div>
</td></tr>";
}
}
return $text;
}
@@ -1021,6 +1040,8 @@ class themeHandler
}
function renderThemeHelp()
{
if($this->themeConfigObj)

View File

@@ -119,7 +119,7 @@ define("TPVLAN_83","Automated download not possible!");
define("TPVLAN_84","[Please Download Manually]");
define("TPVLAN_85","Connecting...");
define("TPVLAN_86","Could not change site theme.");
define("TPVLAN_87","Rendering Theme Config");
// define("TPVLAN_87","Rendering Theme Config"); //XXX Debug info
define("TPVLAN_88","Converter");
define("TPVLAN_89", "Apply dashboard preferences to all administrators");