what's interesting me a lot today is how to make some colors configurable in ACP for each and every style installed.
Let's see, I do have the ACP side with 3 colorpickers which works accordingly to
- config array()
Code: Select all
/* Highlight's colors */
array('config.add', array('hlposts_colors', json_encode(array(
'bckg' => '#b6e0b6',
'text' => '#2c3645',
'bord' => '#2ea7a4',
)
)
)
),
Code: Select all
/* Let's read the style configuration */
$color_configs = json_decode($config['hlposts_colors'], true);
Code: Select all
/* Styles' specific vars */
$color_configs['bckg'] = trim($request->variable('bckg', $color_configs['bckg']));
$color_configs['text'] = trim($request->variable('text', $color_configs['text']));
$color_configs['bord'] = trim($request->variable('bord', $color_configs['bord']));
$config->set('hlposts_colors', json_encode($color_configs));
Code: Select all
/* Colors are here just to be overriden via ACP configuration */
.hlposts-panel {
margin-bottom: 10px;
font-size: 0.9em;
padding: 5px 10px;
border-radius: 7px;
/*hlposts_colors bckg */
background-color: #84cc84;
/*hlposts_colors text */
color: #28313F;
/*hlposts_colors bord */
box-shadow: 1px 2px 3px #000000;
}
overall_header_stylesheets_after.html
Code: Select all
<style>
/*
Colors are set according to user configuration in ACP.
*/
/* Panel */
/* Items color */
.hlposts-panel {
background-color: {{ HLPOSTS_BCKG }};
color: {{ HLPOSTS_TEXT }};
box-shadow: 1px 2px 3px {{ HLPOSTS_BORD }};
}
</style>
core.page_header_after
PHP event, ..
Code: Select all
/* Let's read the style configuration */
$color_configs = json_decode($this->config['hlposts_colors'], true);
$this->template->assign_vars(array(
'HLPOSTS_BCKG' => $color_configs['bckg'],
'HLPOSTS_TEXT' => $color_configs['text'],
'HLPOSTS_BORD' => $color_configs['bord'],
what should I do to make all of this configurable on a per installed style basis?
TIA