You are here

function themekey_load_function in ThemeKey 7.3

Same name and namespace in other branches
  1. 7 themekey_base.inc \themekey_load_function()
  2. 7.2 themekey_base.inc \themekey_load_function()

Magic loading of validation and callback functions.

Return value

TRUE if the function has been loaded, otherwise FALSE

See also

_theme_process_registry()

2 calls to themekey_load_function()
themekey_abstract_rule_chain_form_validate in ./themekey_admin.inc
themekey_property_value in ./themekey_base.inc
Detects if a ThemeKey property's value for the current page request.

File

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

Code

function themekey_load_function($function, $file, $path = '') {
  if (!empty($file)) {
    if (empty($path)) {
      $filename = './' . $file;
      if (file_exists($filename)) {
        require_once $filename;
        if (function_exists($function)) {
          return TRUE;
        }
      }
      foreach (module_implements('themekey_properties') as $module) {
        if (themekey_load_function($function, $file, drupal_get_path('module', $module))) {
          if (function_exists($function)) {
            return TRUE;
          }
        }
      }
    }
    else {
      $filename = './' . $path . '/' . $file;
      if (file_exists($filename)) {
        require_once $filename;
        if (function_exists($function)) {
          return TRUE;
        }
      }
    }
  }
  return FALSE;
}