Posted by kramazeek on December 13, 2010 at 4:16pm
Hi everyone,
Is it possible to clear the cache automatically when someone saves theme settings? I am not so hot at drupal yet, but is there a hook that is fired off when theme settings are saved? Can a function be run then to automatically clear the cache? Thanks!
Comments
Better definition.
Hello Everyone,
I thought I would try to redefine the problem again to the best of my abilities. I am working on a theme that has built in support for superfish drop-down menus. The template.tpl has a custom theme_links hook that creates the correct nested markup for use with the superfish menu script. This function is wrapped in an if statement that checks if superfish is enabled in the theme settings.
So, when superfish menus are enabled in the theme settings, things seem to work(after the cache is cleared). But when the superfish menus are disabled I get an error because the custom theme_links hook no longer exists.
Do I need to attempt to rebuild the theme registry when theme settings are saved? Is that possible? or would it just be easier to do an if else that declares the custom theme_links hook in the template.tpl regardless, see below:
//Check if Superfish dropdown menus are ebabled.
if(theme_get_setting('themebase_superfish_dropdowns')){
themebase_links(){
//create markup for superfish.
}
}else{
themebase_links(){
//default implementation.
}
}
Thanks!