You are here

function icon_extension_hook in Icon API 7

Same name and namespace in other branches
  1. 8 includes/utilities.inc \icon_extension_hook()

Determines whether an extension implements a hook.

Parameters

string $type: The type of extension (theme or module).

string $extension: The name of the extension.

string $hook: The name of the hook (e.g. "help" or "menu").

Return value

bool TRUE if the extension is both installed and enabled, and the hook is implemented in that extension. FALSE if the extension does not implement the hook.

2 calls to icon_extension_hook()
icon_extension_invoke in includes/utilities.inc
Invokes a hook in a particular extension.
icon_providers_support_import in ./icon.module
Returns information about whether a provider supports importing.
1 string reference to 'icon_extension_hook'
icon_reset_static_cache in includes/cache.inc
Clears all static caches used by the icon module.

File

includes/utilities.inc, line 166
utilities.inc Provides useful functions and common tasks.

Code

function icon_extension_hook($type, $extension, $hook) {
  $hooks =& drupal_static(__FUNCTION__, array());

  // Ensure the extension is loaded.
  if (!isset($hooks[$type][$extension])) {
    if ('module' === $type) {
      drupal_load($type, $extension);
    }
    elseif ('theme' === $type && ($include = icon_find_theme_include($extension))) {
      include_once $include;
    }
  }

  // Check to see if the hook is implemented.
  if (!isset($hooks[$type][$extension][$hook])) {
    $hooks[$type][$extension][$hook] = 'module' === $type ? module_hook($extension, $hook) : function_exists($extension . '_' . $hook);
  }
  return $hooks[$type][$extension][$hook];
}