summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--includes/plugins.inc38
2 files changed, 18 insertions, 21 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 22171d7..d79147d 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -14,6 +14,7 @@ Initial inclusion of the stylizer plugin to create user customizable styles from
#709754 by yhahn: Add export_module flag to all default objects so that we can tell where they came from.
#709840 by thsutton: Improper test of AND when displaying access summaries.
#709874 by thsutton: Fix improper test in context exists.
+#711664 by neclimdul: Deprecate the plugin hook which should no longer be used; all plugins should be file based.
ctools 6.x-1.3 (2010-Feb-01)
==============
diff --git a/includes/plugins.inc b/includes/plugins.inc
index 2244d7b..5293552 100644
--- a/includes/plugins.inc
+++ b/includes/plugins.inc
@@ -164,8 +164,7 @@ function ctools_plugin_api_include($owner, $api, $minimum_version, $current_vers
*/
function ctools_get_plugins($module, $type, $id = NULL) {
static $plugins = array();
- static $all_hooks = array();
- static $all_files = array();
+ static $setup = array();
static $info = array();
if (!isset($info[$module][$type])) {
@@ -178,32 +177,26 @@ function ctools_get_plugins($module, $type, $id = NULL) {
// with content updates is convenient.
$cache = cache_get("plugins:$module:$type", $info[$module][$type]['cache table']);
- // if cache load successful, set $all_hooks and $all_files to true.
if (!empty($cache->data)) {
- $plugins[$module][$type] = $cache->data;
- $all_hooks[$module][$type] = TRUE;
- $all_files[$module][$type] = TRUE;
+ // Cache loaded successfuly.
+ $plugins[$module][$type] = $cache->data;
+ // Set $setup to true so we know things where loaded.
+ $setup[$module][$type] = TRUE;
}
else {
+ // Cache load failed so store that we need to write cache later.
$write_cache = TRUE;
}
}
- // Always load all hooks if we need them.
- if (!isset($all_hooks[$module][$type])) {
- $all_hooks[$module][$type] = TRUE;
- $plugins[$module][$type] = ctools_plugin_load_hooks($info[$module][$type]);
- }
-
- // First, see if it's in our hooks before we even bother.
- if ($id && array_key_exists($id, $plugins[$module][$type])) {
- return $plugins[$module][$type][$id];
- }
-
- // Then see if we should load all files. We only do this if we
- // want a list of all plugins.
- if ((!$id || $info[$module][$type]['cache']) && empty($all_files[$module][$type])) {
- $all_files[$module][$type] = TRUE;
+ // See if we should load plugins. We only do this if we want a list of all
+ // plugins or the cache missed.
+ if ((!$id || $info[$module][$type]['cache']) && empty($setup[$module][$type])) {
+ $setup[$module][$type] = TRUE;
+ $plugins[$module][$type] = array();
+ if ($info['use hooks']) {
+ $plugins[$module][$type] = ctools_plugin_load_hooks($info[$module][$type]);
+ }
$plugins[$module][$type] = array_merge($plugins[$module][$type], ctools_plugin_load_includes($info[$module][$type]));
}
@@ -424,6 +417,8 @@ function ctools_find_base_themes($themes, $key, $used_keys = array()) {
* Load plugin info for the provided hook; this is handled separately from
* plugins from files.
*
+ * @deprecated plugin includes should be used in favor of this method.
+ *
* @param $info
* The info array about the plugin as created by ctools_plugin_get_info()
*
@@ -498,6 +493,7 @@ function _ctools_process_data($result, $info, $module, $path, $file) {
'name' => $name,
'path' => $path,
'file' => $file,
+ 'use hooks' => FALSE, // Use deprecated hook definitions.
'plugin module' => $info['module'],
'plugin type' => $info['type'],
);