Same name and namespace in other branches
  1. 10 core/includes/theme.inc \theme_get_setting()
  2. 4.6.x includes/theme.inc \theme_get_setting()
  3. 4.7.x includes/theme.inc \theme_get_setting()
  4. 6.x includes/theme.inc \theme_get_setting()
  5. 7.x includes/theme.inc \theme_get_setting()
  6. 8.9.x core/includes/theme.inc \theme_get_setting()
  7. 9 core/includes/theme.inc \theme_get_setting()

Retrieve a setting for the current theme. This function is designed for use from within themes & engines to determine theme settings made in the admin interface.

Caches values for speed (use $refresh = TRUE to refresh cache)

Parameters

$setting_name: The name of the setting to be retrieved.

$refresh: Whether to reload the cache of settings.

Return value

The value of the requested setting, NULL if the setting does not exist.

4 calls to theme_get_setting()
chameleon_page in themes/chameleon/chameleon.theme
phptemplate_comment in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_comment function to be passed into a pluggable template engine.
phptemplate_node in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_node function to be passed into a pluggable template engine.
phptemplate_page in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_page function to be passed into a pluggable template engine. Uses the arg() function to generate a series of page template files suggestions based on the current path. If none are found, the default page.tpl.php…

File

includes/theme.inc, line 310
The theme system, which controls the output of Drupal.

Code

function theme_get_setting($setting_name, $refresh = FALSE) {
  global $theme_key;
  static $settings;
  if (empty($settings) || $refresh) {
    $settings = theme_get_settings($theme_key);
    $themes = list_themes();
    $theme_object = $themes[$theme_key];
    if ($settings['mission'] == '') {
      $settings['mission'] = variable_get('site_mission', '');
    }
    if (!$settings['toggle_mission']) {
      $settings['mission'] = '';
    }
    if ($settings['toggle_logo']) {
      if ($settings['default_logo']) {
        $settings['logo'] = base_path() . dirname($theme_object->filename) . '/logo.png';
      }
      elseif ($settings['logo_path']) {
        $settings['logo'] = base_path() . $settings['logo_path'];
      }
    }
    if ($settings['toggle_favicon']) {
      if ($settings['default_favicon']) {
        if (file_exists($favicon = dirname($theme_object->filename) . '/favicon.ico')) {
          $settings['favicon'] = base_path() . $favicon;
        }
        else {
          $settings['favicon'] = base_path() . 'misc/favicon.ico';
        }
      }
      elseif ($settings['favicon_path']) {
        $settings['favicon'] = base_path() . $settings['favicon_path'];
      }
      else {
        $settings['toggle_favicon'] = FALSE;
      }
    }
  }
  return isset($settings[$setting_name]) ? $settings[$setting_name] : NULL;
}