You are here

function popups_get_popups in Popups API (Ajax Dialogs) 6.2

Same name and namespace in other branches
  1. 5 popups.module \popups_get_popups()
  2. 6 popups.module \popups_get_popups()
  3. 7 popups.module \popups_get_popups()

Define hook_popups(). Build the list of popup rules from all modules that implement hook_popups.

Retrieves the list of popup rules from all modules that implement hook_popups.

Parameters

$reset: (optional) If set to TRUE, forces the popup rule cache to reset.

2 calls to popups_get_popups()
popups_form_alter in ./popups.module
Implementation of hook_form_alter().
popups_init in ./popups.module
Implementation of hook_init().

File

./popups.module, line 257
This module provides a hook_popups for links to be opened in an Ajax Popup Modal Dialog.

Code

function popups_get_popups($reset = FALSE) {
  static $popups = NULL;
  if (!isset($popups) || $reset) {

    // Get popups hash out of cache.
    if (!$reset && ($cache = cache_get('popups:popups')) && !empty($cache->data)) {
      $popups = $cache->data;
    }
    else {

      // Call all hook_popups and cache results.
      $popups = module_invoke_all('popups');

      // Invoke hook_popups_alter() to allow altering the default popups registry.
      drupal_alter('popups', $popups);

      // Save the popup registry in the cache.
      cache_set('popups:popups', $popups);
    }
  }
  return $popups;
}