I would like for a site owner to have the option to check a box to add some supplemental CSS to a theme. This seems like it should be pretty easy, but I've not done it before.
I am assuming that I will need a config file for the theme.
I will need a config option to check "Yes" for supplemental stylesheet
I will need some code to add the css if the config is set to "yes."
Am I starting in the right place? Can anyone point me to some examples?
OK, I got it. This seems to be doing the trick. I welcome ideas for improving this. (EDITED: to fix a minor syntax error)
template-settings.php
function basis_form_system_theme_settings_alter(&$form, &$form_state) { $form['basis_supplemental_css'] = array( '#type' => 'checkbox', '#title' => t('Do you want to use supplemental css'), '#default_value' => theme_get_setting('basis_supplemental_css', 'basis'), ); }template.php
function basis_preprocess_page(&$variables) { $supplemental_styles = theme_get_setting('basis_supplemental_css'); if ($supplemental_styles==1){ basis_supplemental_css(); } }function basis_supplemental_css() { $basis_path = backdrop_get_path('theme', 'basis'); backdrop_add_css($basis_path . '/css/supplemental.css'); }