function ctools_plugin_get_plugin_type_info

Return the full list of plugin type info for all plugin types registered in the current system.

This function manages its own cache getting/setting, and should always be used as the way to initially populate the list of plugin types. Make sure you call this function to properly populate the ctools_plugin_type_info static variable.

Return value

array A multilevel array of plugin type info, the outer array keyed on module name and each inner array keyed on plugin type name.

3 calls to ctools_plugin_get_plugin_type_info()
ctools_get_plugins in includes/plugins.inc
Fetch a group of plugins by name.
ctools_plugin_get_info in includes/plugins.inc
Ask a module for info about a particular plugin type.
_ctools_registry_files_alter in includes/registry.inc
Implements (via delegation) hook_registry_files_alter().

File

includes/plugins.inc, line 354

Code

function ctools_plugin_get_plugin_type_info($flush = FALSE) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['info_loaded'] =& drupal_static('ctools_plugin_type_info_loaded', FALSE);
    $drupal_static_fast['all_type_info'] =& drupal_static('ctools_plugin_type_info', array());
  }
  $info_loaded =& $drupal_static_fast['info_loaded'];
  $all_type_info =& $drupal_static_fast['all_type_info'];
  // Only trigger info loading once.
  if ($info_loaded && !$flush) {
    return $all_type_info;
  }
  $info_loaded = TRUE;
  $cache = cache_get('ctools_plugin_type_info');
  if (!empty($cache->data) && !$flush) {
    // Plugin type info cache is warm, use it.
    $all_type_info = $cache->data;
  }
  else {
    // Cache expired, refill it.
    foreach (module_implements('ctools_plugin_type') as $module) {
      $module_infos = array();
      $function = $module . '_ctools_plugin_type';
      $module_infos = $function();
      foreach ($module_infos as $plugin_type_name => $plugin_type_info) {
        // Apply defaults. Array addition will not overwrite pre-existing keys.
        $plugin_type_info += array(
          'module' => $module,
          'type' => $plugin_type_name,
          'cache' => FALSE,
          'cache table' => 'cache',
          'classes' => array(),
          'use hooks' => FALSE,
          'defaults' => array(),
          'process' => '',
          'alterable' => TRUE,
          'extension' => 'inc',
          'info file' => FALSE,
          'hook' => $module . '_' . $plugin_type_name,
          'load themes' => FALSE,
        );
        $all_type_info[$module][$plugin_type_name] = $plugin_type_info;
      }
    }
    cache_set('ctools_plugin_type_info', $all_type_info);
  }
  return $all_type_info;
}