You are here

function icon_extension_implements in Icon API 8

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

Determines which extensions are implementing a hook.

Parameters

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

Return value

array An array with the names of the extensions which are implementing this hook.

5 calls to icon_extension_implements()
icon_bundles in ./icon.module
Returns information about all icon bundles.
icon_bundle_configure_form in includes/admin.inc
Menu callback for 'icon_bundle_configure_form'.
icon_bundle_delete in ./icon.module
Delete the icon bundle that matches {icon_bundle}.name in the database.
icon_providers in ./icon.module
Returns information about all icon providers.
icon_render_hooks in ./icon.module
Returns information about icons render hooks.
1 string reference to 'icon_extension_implements'
icon_reset_static_cache in includes/cache.inc
Clears all static caches used by the icon module.

File

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

Code

function icon_extension_implements($hook) {
  $implements =& drupal_static(__FUNCTION__, array());
  if (!isset($implements[$hook])) {
    $implements[$hook] = array();

    // Gather the modules that implement the hook.
    foreach (\Drupal::moduleHandler()
      ->getImplementations($hook) as $module) {
      $implements[$hook][$module] = 'module';
    }

    // Due to how this module caches data, using the global $base_theme_info
    // variable will not work here. That array only contains the active
    // theme. We need to determine whether all enabled themes have a hook
    // definition. To do this, themes must define an 'icon.inc' file somewhere
    // in their directory structure.
    foreach (icon_enabled_themes() as $theme) {
      if ($include = icon_find_theme_include($theme)) {
        @(include_once $include);
        if (function_exists($theme . '_' . $hook)) {
          $implements[$hook][$theme] = 'theme';
        }
      }
    }
  }
  return $implements[$hook];
}