mirror of
https://github.com/e107inc/e107.git
synced 2025-08-31 18:11:56 +02:00
Seamless upgrade of theme prefs when moving to theme_config specification.
bootstrap3 theme upgraded to use theme_config. CDN pref removed in favor of e107::library() core CDN pref.
This commit is contained in:
@@ -2,53 +2,17 @@
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
e107::lan('theme', 'admin',true); // e_PLUGIN.'tinymce4/languages/'.e_LANGUAGE.'_admin.php'
|
||||
e107::lan('theme', 'admin',true);
|
||||
|
||||
// Dummy Theme Configuration File.
|
||||
class theme_bootstrap3 implements e_theme_config
|
||||
// Theme Configuration File.
|
||||
class theme_config implements e_theme_config
|
||||
{
|
||||
function process() // Save posted values from config() fields.
|
||||
{
|
||||
$pref = e107::getConfig();
|
||||
|
||||
$theme_pref = array();
|
||||
$theme_pref['nav_alignment'] = $_POST['nav_alignment'];
|
||||
$theme_pref['usernav_placement'] = $_POST['usernav_placement'];
|
||||
$theme_pref['branding'] = $_POST['branding'];
|
||||
$theme_pref['bootswatch'] = $_POST['bootswatch'];
|
||||
$theme_pref['cdn'] = $_POST['cdn'];
|
||||
|
||||
$pref->set('sitetheme_pref', $theme_pref);
|
||||
$changed = $pref->dataHasChanged();
|
||||
|
||||
if($changed)
|
||||
{
|
||||
// Need to clear cache in order to refresh library information.
|
||||
e107::getCache()->clearAll('system');
|
||||
}
|
||||
|
||||
return $changed;
|
||||
}
|
||||
|
||||
function config($type='front')
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
|
||||
$brandingOpts = array('sitename'=>LAN_THEMEPREF_04, 'logo' => LAN_THEMEPREF_05, 'sitenamelogo'=>LAN_THEMEPREF_06);
|
||||
|
||||
$var[0]['caption'] = LAN_THEMEPREF_00;
|
||||
$var[0]['html'] = $frm->select('branding', $brandingOpts, e107::pref('theme', 'branding', 'sitename'));
|
||||
$var[0]['help'] = "";
|
||||
|
||||
$var[1]['caption'] = LAN_THEMEPREF_01;
|
||||
$var[1]['html'] = $frm->select('nav_alignment', array('left'=>LAN_THEMEPREF_07,'right'=> LAN_THEMEPREF_08), e107::pref('theme', 'nav_alignment', 'left'));
|
||||
$var[1]['help'] = "";
|
||||
|
||||
$var[2]['caption'] = LAN_THEMEPREF_02;
|
||||
$var[2]['html'] = $frm->select('usernav_placement', array('top'=>LAN_THEMEPREF_09, 'bottom'=>LAN_THEMEPREF_10), e107::pref('theme', 'usernav_placement', 'top'));
|
||||
$var[2]['help'] = "";
|
||||
|
||||
|
||||
$bootswatch = array(
|
||||
// '' => LAN_DEFAULT,
|
||||
"cerulean"=> 'Cerulean',
|
||||
@@ -69,33 +33,18 @@ class theme_bootstrap3 implements e_theme_config
|
||||
"yeti"=> 'Yeti',
|
||||
);
|
||||
|
||||
$cdnFront = array(
|
||||
'cdnjs' => "CDNJS (Cloudflare)",
|
||||
'jsdelivr' => "jsDelivr"
|
||||
// google ? No fontawesome support?
|
||||
|
||||
);
|
||||
|
||||
|
||||
$previewLink = " <a class='btn btn-default e-modal' data-modal-caption=\"Use the 'Themes' menu to view the selection.\" href='http://bootswatch.com/default/'>".LAN_PREVIEW."</a>";
|
||||
|
||||
$var[3]['caption'] = LAN_THEMEPREF_03;
|
||||
$var[3]['html'] = "<div class='form-inline'>".$frm->select('bootswatch', $bootswatch, e107::pref('theme', 'bootswatch', ''),null,LAN_DEFAULT ).$previewLink."</div>";
|
||||
$var[3]['help'] = "";
|
||||
$fields = array(
|
||||
'branding' => array('title'=>LAN_THEMEPREF_00, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> $brandingOpts)),
|
||||
'nav_alignment' => array('title'=>LAN_THEMEPREF_01, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> array('left'=> LAN_THEMEPREF_07,'right'=> LAN_THEMEPREF_08))),
|
||||
'usernav_placement' => array('title'=>LAN_THEMEPREF_02, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> array('top'=> LAN_THEMEPREF_09, 'bottom'=> LAN_THEMEPREF_10))),
|
||||
'bootswatch' => array('title'=>LAN_THEMEPREF_03, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> $bootswatch, 'post'=>$previewLink)),
|
||||
);
|
||||
|
||||
$var[4]['caption'] = "CDN";
|
||||
$var[4]['html'] = $frm->select('cdn', $cdnFront, e107::pref('theme', 'cdn', '') );
|
||||
$var[4]['help'] = "";
|
||||
return $fields;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// $var[1]['caption'] = "Sample configuration field 2";
|
||||
// $var[1]['html'] = $frm->text('_blank_example2', e107::pref('theme', 'example2', 'default'));
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user