You are here

function icon_render_hooks in Icon API 7

Same name and namespace in other branches
  1. 8 icon.module \icon_render_hooks()

Returns information about icons render hooks.

Parameters

string $hook: (optional) The name of the render hook to return information for. If omitted, render hook information provided by all modules and themes will be returned.

bool $reset: Boolean to force reset of the cached data. Default: FALSE.

Return value

array|false An associative array containing render hook information from all modules and themes, the information for the render hook specified by $hook, or FALSE if the render hook $name is not registered.

See also

hook_icon_render_hooks()

3 calls to icon_render_hooks()
icon_clear_all_caches in includes/cache.inc
Clears all caches used by the icon module.
icon_theme in includes/theme.inc
Implements hook_theme().
template_preprocess_icon in includes/theme.inc
Implements hook_preprocess_icon().
2 string references to 'icon_render_hooks'
icon_hook_info in ./icon.module
Implements hook_hook_info().
icon_reset_static_cache in includes/cache.inc
Clears all static caches used by the icon module.

File

./icon.module, line 221
icon.module Provides icon integration with menu items.

Code

function &icon_render_hooks($hook = NULL, $reset = FALSE) {
  $hooks =& drupal_static(__FUNCTION__);
  if (!isset($hooks) || $reset) {
    if (!$reset && ($cache = cache_get('icon_render_hooks')) && !empty($cache->data)) {
      $hooks = $cache->data;
    }
    else {
      $hooks = array();

      // Gather information from extensions that implement
      // hook_icon_render_hooks().
      foreach (icon_extension_implements('icon_render_hooks') as $extension => $type) {
        $extension_hooks = (array) icon_extension_invoke($type, $extension, 'icon_render_hooks');
        foreach ($extension_hooks as $render_hook => $data) {
          if (!is_string($render_hook) && is_string($data)) {
            $render_hook = $data;
            $data = array();
          }
          $data['name'] = $render_hook;
          $data['type'] = $type;
          $data[$type] = $extension;
          if (!isset($data['file'])) {
            $data['file'] = 'module' === $type ? $extension . '.module' : 'template.php';
          }
          if (!isset($data['path'])) {
            $data['path'] = drupal_get_path($type, $extension);
          }
          $hooks[$render_hook] = $data;
        }
      }

      // Allow extensions to alter render hook information.
      drupal_alter('icon_render_hooks', $hooks);

      // Cache the render hook information.
      cache_set('icon_render_hooks', $hooks);
    }
  }
  if (isset($hook)) {
    if (!empty($hooks[$hook])) {
      return $hooks[$hook];
    }
    else {
      $false = FALSE;
      return $false;
    }
  }
  return $hooks;
}