Question

I am trying to programmatically disable logo and site name. I have seen some variables for these set in modules/system/system.admin.inc but haven't been able to disable them through my profile installer settings.

What is the proper way to disable them? I looked around the internet but found no one has really looked into this issue.

global theme settings

enter image description here

Was it helpful?

Solution

See here for a related question.

The theme settings are not individually saved as variables. They are all in a single variable, whose name depends on your theme. For example, if your theme name is mytheme, the variable name will be theme_mytheme_settings.

You can disable the logo and name like this:

$my_settings = variable_get('theme_mytheme_settings', array());
$my_settings['toggle_logo'] = 0;
$my_settings['toggle_name'] = 0;
variable_set('theme_mytheme_settings', $my_settings);

You can also disable settings by means of the features key in the .info file for your theme. The defaults are:

features[] = logo
features[] = name
features[] = slogan
features[] = node_user_picture
features[] = comment_user_picture
features[] = comment_user_verification
features[] = favicon
features[] = main_menu
features[] = secondary_menu

If you don't specify any of these, all are enabled. If you specify some, only the ones you specify are enabled. So if you wanted to hide logo and site name, you would put this in your .info file:

; features[] = logo
; features[] = name
features[] = slogan
features[] = node_user_picture
features[] = comment_user_picture
features[] = comment_user_verification
features[] = favicon
features[] = main_menu
features[] = secondary_menu

See the theme settings documentation for more info. You need to be careful with this depending on what theme you are using. If you're overriding a base theme, these are the keys, but a contributed or custom theme might have different keys.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top