You are here

function themekey_get_global_parameters in ThemeKey 7.2

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. 6.3 themekey_base.inc \themekey_get_global_parameters()
  4. 7.3 themekey_base.inc \themekey_get_global_parameters()
  5. 7 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 209
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'));
    $path_condition = new StdClass();
    $path_condition->property = 'drupal:path';
    $paths = variable_get('themekey_paths', array());
    foreach ($paths as $item) {
      $path_condition->value = $item['path'];
      $parameters = array();
      if (themekey_match_path($path_condition, $parameters)) {
        foreach ($parameters['internal:temp_wildcards'] as $index => $item_wildcard) {
          $global_parameters[$item['wildcards'][$index]] = $item_wildcard;
        }
        if (count($item['callbacks'])) {
          foreach ($item['callbacks'] as $callback) {
            $callback($item, $global_parameters);
          }
        }
      }
    }
  }
  return $global_parameters;
}