system_find_base_theme

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

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

Версии
6
system_find_base_theme($themes, $key, $used_keys = array())

Recursive function to find the top level base theme. Themes can inherit templates and function implementations from earlier themes.

Параметры

$themes An array of available themes.

$key The name of the theme whose base we are looking for.

$used_keys A recursion parameter preventing endless loops.

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

Returns the top level parent that has no ancestor or returns NULL if there isn't a valid parent.

▾ 2 функции вызывают system_find_base_theme()

system_find_base_theme in modules/system/system.module
Recursive function to find the top level base theme. Themes can inherit templates and function implementations from earlier themes.
_system_theme_data in modules/system/system.module
Helper function to scan and collect theme .info data and their engines.

Код

<?php
function system_find_base_theme($themes, $key, $used_keys = array()) {
  $base_key = $themes[$key]->info['base theme'];
  // Does the base theme exist?
  if (!isset($themes[$base_key])) {
    return NULL;
  }

  // Is the base theme itself a child of another theme?
  if (isset($themes[$base_key]->info['base theme'])) {
    // Prevent loops.
    if (!empty($used_keys[$base_key])) {
      return NULL;
    }
    $used_keys[$base_key] = TRUE;
    return system_find_base_theme($themes, $base_key, $used_keys);
  }
  // If we get here, then this is our parent theme.
  return $base_key;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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