You are here

function panels_get_plugins in Panels 5.2

Same name and namespace in other branches
  1. 6.2 includes/plugins.inc \panels_get_plugins()

Fetch a group of plugins by name.

Parameters

$plugin: This is the name of the plugin, and also the name of the directory.

$hook: This is the hook to call to get the info for the plugin.

Return value

An array of information arrays about the plugins received.

17 calls to panels_get_plugins()
panels_get_argument in includes/plugins.inc
Collate information about a specific panel argument.
panels_get_arguments in includes/plugins.inc
Collate information about all available panel arguments.
panels_get_cache in includes/plugins.inc
Fetch a cache plugin
panels_get_caches in includes/plugins.inc
Fetch all cache plugins
panels_get_content_type in includes/plugins.inc
Fetch a content_type plugin

... See full list

File

includes/plugins.inc, line 1506
plugins.inc

Code

function panels_get_plugins($plugin, $hook, $id = NULL) {
  static $plugins = array();
  static $all_hooks = array();
  static $all_files = array();

  // Always load all hooks if we need them.
  if (!isset($all_hooks[$plugin])) {
    $all_hooks[$plugin] = TRUE;
    $plugins[$plugin] = panels_load_hooks($hook);
  }

  // First, see if it's in our hooks before we even bother.
  if ($id && array_key_exists($id, $plugins[$plugin])) {
    return $plugins[$plugin][$id];
  }

  // Then see if we should load all files. We only do this if we
  // want a list of all plugins.
  if (!$id && empty($all_files[$plugin])) {
    $all_files[$plugin] = TRUE;
    $plugins[$plugin] = array_merge($plugins[$plugin], panels_load_includes($plugin, $hook));
  }

  // If no id was requested, we are finished here:
  if (!$id) {
    return $plugins[$plugin];
  }

  // Check to see if we need to look for the file
  if (!array_key_exists($id, $plugins[$plugin])) {
    $result = panels_load_includes($plugin, $hook, $id);

    // Set to either what was returned or NULL.
    $plugins[$plugin][$id] = isset($result[$id]) ? $result[$id] : NULL;
  }

  // At this point we should either have the plugin, or a NULL.
  return $plugins[$plugin][$id];
}