When adding an advanced fields to customizer.json, like a select (dropdown), it will also be saved to customizer.css.
{
"general": {
"title": "text_general_title",
"description": "text_general_description",
"control": {
"sitename": {
"selector": "#logo a"
}
}
},
"colors": {
"title": "text_colors_title",
"description": "text_colors_description",
"control": {
"container_background-color": {
"type": "color",
"label": "text_colors_container_background_label",
"default": "#bdc3c7",
"selector": "body"
},
"container-color_color": {
"type": "color",
"label": "text_colors_container_color_label",
"default": "#666666",
"selector": "body"
},
"colorscheme": {
"type": "select",
"label": "Colour scheme",
"default": "blue",
"choices": {
"blue": "Blue",
"green": "Green",
"purple": "Purple",
"red": "Red"
},
"selector": "colors"
}
}
},
"images": {
"title": "text_images_title",
"description": "text_images_description",
"control": {
"logo": {
"selector": "#logo a img"
}
}
}
}


The colour scheme selection will be saved in customizer.css as:
 colors { 
: purple;
}


And a error is displayed / logged:
PHP Notice: Undefined offset: 1 in /admin/model/appearance/customizer.php on line 77
In Themes
Wednesday, October 04 2017, 09:03 PM
Share this post:
Responses (1)
  • Accepted Answer

    Wednesday, October 04 2017, 11:27 PM - #Permalink
    This PR will fix this / add support for colorscheme: https://github.com/arastta/arastta/pull/723

    But now I wonder what's the best way to pull the customizer settings per theme, t.ex. to get the correct stylesheet in header.tpl ...??

    We could do something like this in header.tpl, but it's not the best place:
    <?php
    // Get Customizer setting
    $this->load->model('appearance/customizer');
    $customizer = $this->model_appearance_customizer->getDefaultData('customizer');
    ?>
    <!DOCTYPE html>
    ...
    ...
    <head>
    ...
    ...
    <l-ink href="/catalog/view/theme/mytheme/stylesheet/colorscheme_<?php echo $customizer['colorscheme']; ?>.css" rel="stylesheet">


    Any better core supported way? If not, maybe it should be added!
    The reply is currently minimized Show
Your Reply