mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Allow theme config page to use custom methods. (see bootstrap3 for example)
This commit is contained in:
@@ -814,6 +814,7 @@ class themeHandler
|
|||||||
var $frm;
|
var $frm;
|
||||||
var $fl;
|
var $fl;
|
||||||
var $themeConfigObj = null;
|
var $themeConfigObj = null;
|
||||||
|
var $themeConfigFormObj= null;
|
||||||
var $noLog = FALSE;
|
var $noLog = FALSE;
|
||||||
private $curTheme = null;
|
private $curTheme = null;
|
||||||
|
|
||||||
@@ -1816,6 +1817,11 @@ class themeHandler
|
|||||||
if(class_exists('theme_config')) // new v2.1.4 theme_config is the class name.
|
if(class_exists('theme_config')) // new v2.1.4 theme_config is the class name.
|
||||||
{
|
{
|
||||||
$this->themeConfigObj = new theme_config();
|
$this->themeConfigObj = new theme_config();
|
||||||
|
|
||||||
|
if(class_exists('theme_config_form')) // new v2.1.7
|
||||||
|
{
|
||||||
|
$this->themeConfigFormObj = new theme_config_form();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif(class_exists($className)) // old way.
|
elseif(class_exists($className)) // old way.
|
||||||
{
|
{
|
||||||
@@ -1834,7 +1840,9 @@ class themeHandler
|
|||||||
{
|
{
|
||||||
|
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
$frm = e107::getForm();
|
|
||||||
|
$frm = ($this->themeConfigFormObj !== null) ? $this->themeConfigFormObj : e107::getForm();
|
||||||
|
|
||||||
$pref = e107::getConfig()->getPref();
|
$pref = e107::getConfig()->getPref();
|
||||||
e107::getDebug()->log("Rendering Theme Config");
|
e107::getDebug()->log("Rendering Theme Config");
|
||||||
|
|
||||||
@@ -1851,13 +1859,12 @@ class themeHandler
|
|||||||
{
|
{
|
||||||
$var = call_user_func(array(&$this->themeConfigObj, 'config'));
|
$var = call_user_func(array(&$this->themeConfigObj, 'config'));
|
||||||
$text = ''; // avoid notice
|
$text = ''; // avoid notice
|
||||||
|
|
||||||
foreach ($var as $field=>$val)
|
foreach ($var as $field=>$val)
|
||||||
{
|
{
|
||||||
if(is_numeric($field))
|
if(is_numeric($field))
|
||||||
{
|
{
|
||||||
$text .= "<tr><td><b>".$val['caption']."</b>:</td><td colspan='2'>".$val['html']."<div class='field-help'>".$val['help']."</div>
|
$text .= "<tr><td><b>".$val['caption']."</b>:</td><td colspan='2'>".$val['html']."<div class='field-help'>".$val['help']."</div></td></tr>";
|
||||||
</td></tr>";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1867,8 +1874,7 @@ class themeHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tdClass = !empty($val['writeParms']['post']) ? 'form-inline' : '';
|
$tdClass = !empty($val['writeParms']['post']) ? 'form-inline' : '';
|
||||||
$text .= "<tr><td><b>".$val['title']."</b>:</td><td class='".$tdClass."' colspan='2'>".$frm->renderElement($field, $value[$field], $val)."<div class='field-help'>".$val['help']."</div>
|
$text .= "<tr><td><b>".$val['title']."</b>:</td><td class='".$tdClass."' colspan='2'>".$frm->renderElement($field, $value[$field], $val)."<div class='field-help'>".$val['help']."</div></td></tr>";
|
||||||
</td></tr>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,5 +53,17 @@ class theme_config implements e_theme_config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Custom Methods
|
||||||
|
class theme_config_form extends e_form
|
||||||
|
{
|
||||||
|
|
||||||
?>
|
function custom_method($value,$mode,$parms) // named the same as $fields key.(eg. 'branding') Used when type = 'method'
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->text('custom_method', $value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
Reference in New Issue
Block a user