init_theme

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/theme.inc, строка 31

Версии
5 – 6
init_theme()

Инициализирует систему темизации и загружает тему.

▾ 5 функции вызывают init_theme()

block_admin_display in modules/block/block.module
Generate main block administration form.
path_to_engine in includes/theme.inc
Return the path to the currently selected engine.
path_to_theme in includes/theme.inc
Return the path to the currently selected theme.
theme_get_function in includes/theme.inc
Determine if a theme function exists, and if so return which one was found.
_block_rehash in modules/block/block.module
Update the 'blocks' DB table with the blocks currently exported by modules.

Код

<?php
function init_theme() {
  global $theme, $user, $custom_theme, $theme_engine, $theme_key;

  // If $theme is already set, assume the others are set, too, and do nothing
  if (isset($theme)) {
    return;
  }

  drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
  $themes = list_themes();

  // Only select the user selected theme if it is available in the
  // list of enabled themes.
  $theme = !empty($user->theme) && !empty($themes[$user->theme]->status) ? $user->theme : variable_get('theme_default', 'garland');


  // Allow modules to override the present theme... only select custom theme
  // if it is available in the list of installed themes.
  $theme = $custom_theme && $themes[$custom_theme] ? $custom_theme : $theme;

  // Store the identifier for retrieving theme settings with.
  $theme_key = $theme;

  // If we're using a style, load its appropriate theme,
  // which is stored in the style's description field.
  // Also add the stylesheet using drupal_add_css().
  // Otherwise, load the theme.
  if (strpos($themes[$theme]->filename, '.css')) {
    // File is a style; loads its CSS.
    // Set theme to its template/theme
    drupal_add_css($themes[$theme]->filename, 'theme');
    $theme = basename(dirname($themes[$theme]->description));
  }
  else {
    // File is a template/theme
    // Load its CSS, if it exists
    if (file_exists($stylesheet = dirname($themes[$theme]->filename) .'/style.css')) {
      drupal_add_css($stylesheet, 'theme');
    }
  }

  if (strpos($themes[$theme]->filename, '.theme')) {
   // file is a theme; include it
   include_once './' . $themes[$theme]->filename;
  }
  elseif (strpos($themes[$theme]->description, '.engine')) {
    // file is a template; include its engine
    include_once './' . $themes[$theme]->description;
    $theme_engine = basename($themes[$theme]->description, '.engine');
    if (function_exists($theme_engine .'_init')) {
      call_user_func($theme_engine .'_init', $themes[$theme]);
    }
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему