function boxes_fetch_plugin_info in Boxes 7.2
Fetch the widget plugin info
4 calls to boxes_fetch_plugin_info()
- boxes_admin_ui_page_title in boxes_admin_ui/
boxes_admin_ui.module - Page title for block types
- boxes_edit in includes/
boxes.pages.inc - Edit box page callback
- boxes_load_plugin_class in ./
boxes.module - Load a widget class
- boxes_load_plugin_class_all in ./
boxes.module - Load all widget classes
1 string reference to 'boxes_fetch_plugin_info'
- boxes_reset in ./
boxes.module - Reset the static variables and caches
File
- ./
boxes.module, line 257
Code
function boxes_fetch_plugin_info($plugin = NULL) {
$plugins =& drupal_static(__FUNCTION__);
ctools_include('plugins');
if (empty($plugins)) {
if (($cache = cache_get('boxes_plugins')) && !empty($cache->data)) {
$plugins = $cache->data;
}
else {
$plugins = ctools_get_plugins('boxes', 'types');
// Only use modules with the same version.
$allowed_modules = array_keys(ctools_plugin_api_info('boxes', 'types', boxes_min_version(), boxes_current_version()));
foreach ($plugins as $key => $plugin_value) {
if (!in_array($plugin_value['module'], $allowed_modules) || $plugin_value['abstract']) {
unset($plugins[$key]);
}
}
cache_set('boxes_plugins', $plugins);
}
}
if (empty($plugin)) {
return $plugins;
}
else {
// Make sure the plugin is in the cache.
if (!isset($plugins[$plugin])) {
$plugin_info = ctools_get_plugins('boxes', 'types', $plugin);
if (empty($allowed_modules)) {
$allowed_modules = array_keys(ctools_plugin_api_info('boxes', 'types', boxes_current_version(), boxes_min_version()));
}
if (in_array($plugin_info['module'], $allowed_modules)) {
$plugins[$plugin] = $plugin_info;
cache_set('boxes_plugins', $plugins);
}
}
// If we still don't have the plugin then return NULL.
if (empty($plugins[$plugin])) {
return NULL;
}
return $plugins[$plugin];
}
}