function _views_fetch_plugin_data

Fetch the plugin data from cache.

1 call to _views_fetch_plugin_data()
views_fetch_plugin_data in ./views.module
Fetch the plugin data from cache.

File

includes/cache.inc, line 129

Code

function _views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE) {
    static $cache = NULL;
    if (!isset($cache) || $reset) {
        // Load necessary code once.
        if (!isset($cache)) {
            views_include('plugins');
            views_include_handlers();
        }
        // Because plugin data contains translated strings, and as such can be
        // expensive to build, the results are cached per language.
        global $language;
        $cache_key = 'views:plugin_data:' . $language->language;
        if (!$reset) {
            if ($cache = cache_get($cache_key)) {
                $cache = $cache->data;
            }
        }
        // If not available in the cache, build it and cache it.
        if (!$cache || $reset) {
            $cache = views_discover_plugins();
            cache_set($cache_key, $cache);
        }
    }
    if (!$type && !$plugin) {
        return $cache;
    }
    elseif (!$plugin) {
        // Not in the if above so the else below won't run.
        if (isset($cache[$type])) {
            return $cache[$type];
        }
    }
    elseif (isset($cache[$type][$plugin])) {
        return $cache[$type][$plugin];
    }
    // Return an empty array if there is no match.
    return array();
}