You are here

function themekey_get_global_parameters in ThemeKey 6.3

Same name and namespace in other branches
  1. 6.4 themekey_base.inc \themekey_get_global_parameters()
  2. 6.2 themekey_base.inc \themekey_get_global_parameters()
  3. 7.3 themekey_base.inc \themekey_get_global_parameters()
  4. 7 themekey_base.inc \themekey_get_global_parameters()
  5. 7.2 themekey_base.inc \themekey_get_global_parameters()

Assigns global parameters' values to ThemeKey properties. Therefore, it calls hook_themekey_global()

Return value

associative array containing some ThemeKey properties and their values

3 calls to themekey_get_global_parameters()
themekey_cron_clear_page_cache in ./themekey_cron.inc
Checks rules containing time-based properties when cron runs. ThemeKey will carefully clean up the page cache if necessary to provide the right theme to anonymous users automatically, e.g., a Christmas theme.
themekey_debug_properties in ./themekey_debug.module
Iterates over all ThemeKey Properties and prints out their current values.
themekey_match_rules in ./themekey_base.inc
This function steps through the rule chain and returns a theme.

File

./themekey_base.inc, line 175
The functions in this file are the back end of ThemeKey.

Code

function themekey_get_global_parameters() {
  static $global_parameters = NULL;
  if (is_null($global_parameters)) {
    $global_parameters = array_merge_recursive(themekey_invoke_modules('themekey_global'), module_invoke_all('themekey_global'));
    $get_q_parts = explode('/', themekey_get_q());
    $paths = variable_get('themekey_paths', array());
    foreach ($paths as $item) {
      $item_parts = explode('/', $item['path']);
      $wildcards = themekey_match_path_parts($get_q_parts, $item_parts);
      if (!empty($wildcards)) {
        foreach ($item['wildcards'] as $index => $item_wildcard) {
          $global_parameters[$item_wildcard] = $wildcards[$index];
        }
        if (count($item['callbacks'])) {
          foreach ($item['callbacks'] as $callback) {
            $callback($item, $global_parameters);
          }
        }
      }
    }
  }
  return $global_parameters;
}