You are here

function ctools_plugin_get_directories in Chaos Tool Suite (ctools) 7

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

Get a list of directories to search for plugins of the given type.

This utilizes hook_ctools_plugin_directory() to determine a complete list of directories. Only modules that implement this hook and return a string value will have their directories included.

Parameters

$info: The $info array for the plugin as returned by ctools_plugin_get_info().

Return value

array An array of directories to search.

1 call to ctools_plugin_get_directories()
ctools_plugin_load_includes in includes/plugins.inc
Load plugins from a directory.

File

includes/plugins.inc, line 521
Contains routines to organize and load plugins. It allows a special variation of the hook system so that plugins can be kept in separate .inc files, and can be either loaded all at once or loaded only when necessary.

Code

function ctools_plugin_get_directories($info) {
  $directories = array();
  foreach (module_implements('ctools_plugin_directory') as $module) {
    $function = $module . '_ctools_plugin_directory';
    $result = $function($info['module'], $info['type']);
    if ($result && is_string($result)) {
      $directories[$module] = drupal_get_path('module', $module) . '/' . $result;
    }
  }
  if (!empty($info['load themes'])) {
    $themes = _ctools_list_themes();
    foreach ($themes as $name => $theme) {
      if (!empty($theme->info['plugins'][$info['module']][$info['type']])) {
        $directories[$name] = drupal_get_path('theme', $name) . '/' . $theme->info['plugins'][$info['module']][$info['type']];
      }
    }
  }
  return $directories;
}