_system_theme_data

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

modules/system/system.module, строка 832

Версии
6
_system_theme_data()

Helper function to scan and collect theme .info data and their engines.

Возвращаемое значение

An associative array of themes information.

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

drupal_flush_all_caches in includes/common.inc
Flush all cached data on the site.
list_themes in includes/theme.inc
Возвращает список доступных для использования на данный момент тем.
system_theme_data in modules/system/system.module
Собирает данные о всех доступных темах.
template_preprocess_maintenance_page in includes/theme.maintenance.inc
The variables generated here is a mirror of template_preprocess_page(). This preprocessor will run it's course when theme_maintenance_page() is invoked. It is also used in theme_install_page() and theme_update_page() to keep all the variables...
update_check_incompatibility in ./update.php
Вспомогательная функция для проверки совместимости модуля или темы.

Код

<?php
function _system_theme_data() {
  static $themes_info = array();

  if (empty($themes_info)) {
    // Find themes
    $themes = drupal_system_listing('\.info$', 'themes');
    // Find theme engines
    $engines = drupal_system_listing('\.engine$', 'themes/engines');

    $defaults = system_theme_default();

    $sub_themes = array();
    // Read info files for each theme
    foreach ($themes as $key => $theme) {
      $themes[$key]->info = drupal_parse_info_file($theme->filename) + $defaults;

      // Invoke hook_system_info_alter() to give installed modules a chance to
      // modify the data in the .info files if necessary.
      drupal_alter('system_info', $themes[$key]->info, $themes[$key]);

      if (!empty($themes[$key]->info['base theme'])) {
        $sub_themes[] = $key;
      }
      if (empty($themes[$key]->info['engine'])) {
        $filename = dirname($themes[$key]->filename) .'/'. $themes[$key]->name .'.theme';
        if (file_exists($filename)) {
          $themes[$key]->owner = $filename;
          $themes[$key]->prefix = $key;
        }
      }
      else {
        $engine = $themes[$key]->info['engine'];
        if (isset($engines[$engine])) {
          $themes[$key]->owner = $engines[$engine]->filename;
          $themes[$key]->prefix = $engines[$engine]->name;
          $themes[$key]->template = TRUE;
        }
      }

      // Give the stylesheets proper path information.
      $pathed_stylesheets = array();
      foreach ($themes[$key]->info['stylesheets'] as $media => $stylesheets) {
        foreach ($stylesheets as $stylesheet) {
          $pathed_stylesheets[$media][$stylesheet] = dirname($themes[$key]->filename) .'/'. $stylesheet;
        }
      }
      $themes[$key]->info['stylesheets'] = $pathed_stylesheets;

      // Give the scripts proper path information.
      $scripts = array();
      foreach ($themes[$key]->info['scripts'] as $script) {
        $scripts[$script] = dirname($themes[$key]->filename) .'/'. $script;
      }
      $themes[$key]->info['scripts'] = $scripts;
      // Give the screenshot proper path information.
      if (!empty($themes[$key]->info['screenshot'])) {
        $themes[$key]->info['screenshot'] = dirname($themes[$key]->filename) .'/'. $themes[$key]->info['screenshot'];
      }
    }

    // Now that we've established all our master themes, go back and fill in
    // data for subthemes.
    foreach ($sub_themes as $key) {
      $base_key = system_find_base_theme($themes, $key);
      if (!$base_key) {
        continue;
      }
      // Copy the 'owner' and 'engine' over if the top level theme uses a
      // theme engine.
      if (isset($themes[$base_key]->owner)) {
        if (isset($themes[$base_key]->info['engine'])) {
          $themes[$key]->info['engine'] = $themes[$base_key]->info['engine'];
          $themes[$key]->owner = $themes[$base_key]->owner;
          $themes[$key]->prefix = $themes[$base_key]->prefix;
        }
        else {
          $themes[$key]->prefix = $key;
        }
      }
    }

    $themes_info = $themes;
  }

  return $themes_info;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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