theme_get_settings

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 theme_get_settings($key = NULL)

Retrieve an associative array containing the settings for a theme.

The final settings are arrived at by merging the default settings, the site-wide settings, and the settings defined for the specific theme. If no $key was specified, only the site-wide theme defaults are retrieved.

The default values for each of settings are also defined in this function. To add new settings, add their default values here, and then add form elements to system_theme_settings() in system.module.

Übergabeparameter

$key The template/style value for a given theme.

Rückgabewert

An associative array containing theme settings.

▾ 2 functions call theme_get_settings()

system_theme_settings in modules/system/system.admin.inc
Form builder; display theme configuration for entire site and individual themes.
theme_get_setting in includes/theme.inc
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.

Code

includes/theme.inc, line 947

<?php
function theme_get_settings($key = NULL) {
  $defaults = array(
    'mission'                       =>  '',
    'default_logo'                  =>  1,
    'logo_path'                     =>  '',
    'default_favicon'               =>  1,
    'favicon_path'                  =>  '',
    'primary_links'                 =>  1,
    'secondary_links'               =>  1,
    'toggle_logo'                   =>  1,
    'toggle_favicon'                =>  1,
    'toggle_name'                   =>  1,
    'toggle_search'                 =>  1,
    'toggle_slogan'                 =>  0,
    'toggle_mission'                =>  1,
    'toggle_node_user_picture'      =>  0,
    'toggle_comment_user_picture'   =>  0,
    'toggle_primary_links'          =>  1,
    'toggle_secondary_links'        =>  1,
  );

  if (module_exists('node')) {
    foreach (node_get_types() as $type => $name) {
      $defaults['toggle_node_info_' . $type] = 1;
    }
  }
  $settings = array_merge($defaults, variable_get('theme_settings', array()));

  if ($key) {
    $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_' . $key . '_settings'), array()));
  }

  // Only offer search box if search.module is enabled.
  if (!module_exists('search') || !user_access('search content')) {
    $settings['toggle_search'] = 0;
  }

  return $settings;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen