function ctools_cache_find_plugin
Take a mechanism and return a plugin and data.
Parameters
string $mechanism: A string containing the plugin name, and an optional data element to send to the plugin separated by two colons.
Return value
array An array, the first element will be the plugin and the second element will be the data. If the plugin could not be found, the $plugin will be NULL.
4 calls to ctools_cache_find_plugin()
- CtoolsUnitObjectCachePlugins::testFindExportUICachePlugin in tests/
object_cache_unit.test - Test to see that we can find the standard export_ui plugin.
- CtoolsUnitObjectCachePlugins::testFindFoobarbazCachePlugin in tests/
object_cache_unit.test - Test to see that we don't find plugins that aren't there.
- CtoolsUnitObjectCachePlugins::testFindSimpleCachePlugin in tests/
object_cache_unit.test - Test to see that we can find the standard simple plugin.
- ctools_cache_operation in includes/
cache.inc - Perform a secondary operation on an indirect cache.
File
-
includes/
cache.inc, line 144
Code
function ctools_cache_find_plugin($mechanism) {
if (strpos($mechanism, '::') !== FALSE) {
// Use explode(2) to ensure that the data can contain double
// colons, just in case.
list($name, $data) = explode('::', $mechanism, 2);
}
else {
$name = $mechanism;
$data = '';
}
if (empty($name)) {
return array(
NULL,
$data,
);
}
ctools_include('plugins');
$plugin = ctools_get_plugins('ctools', 'cache', $name);
return array(
$plugin,
$data,
);
}