function themekey_load_function in ThemeKey 7
Same name and namespace in other branches
- 7.3 themekey_base.inc \themekey_load_function()
 - 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
2 calls to themekey_load_function()
- themekey_property_value in ./
themekey_base.inc  - Detects if a ThemeKey property's value for the current page request.
 - themekey_rule_chain_form_validate in ./
themekey_admin.inc  - Validation of
 
File
- ./
themekey_base.inc, line 593  - 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;
}