function views_discover_plugins

Builds and return a list of all plugins available in the system.

Return value

Nested array of plugins, grouped by type.

1 call to views_discover_plugins()
_views_fetch_plugin_data in includes/cache.inc
Fetch the plugin data from cache.

File

includes/plugins.inc, line 412

Code

function views_discover_plugins() {
    $cache = array(
        'display' => array(),
        'style' => array(),
        'row' => array(),
        'argument default' => array(),
        'argument validator' => array(),
        'access' => array(),
        'cache' => array(),
        'exposed_form' => array(),
    );
    // Get plugins from all modules.
    foreach (module_implements('views_plugins') as $module) {
        $function = $module . '_views_plugins';
        $result = $function();
        if (!is_array($result)) {
            continue;
        }
        $module_dir = isset($result['module']) ? $result['module'] : $module;
        // Setup automatic path/file finding for theme registration.
        if ($module_dir == 'views') {
            $theme_path = drupal_get_path('module', $module_dir) . '/theme';
            $theme_file = 'theme.inc';
            $path = drupal_get_path('module', $module_dir) . '/plugins';
        }
        else {
            $theme_path = $path = drupal_get_path('module', $module_dir);
            $theme_file = "{$module}.views.inc";
        }
        foreach ($result as $type => $info) {
            if ($type == 'module') {
                continue;
            }
            foreach ($info as $plugin => $def) {
                $def['module'] = $module_dir;
                if (!isset($def['theme path'])) {
                    $def['theme path'] = $theme_path;
                }
                if (!isset($def['theme file'])) {
                    $def['theme file'] = $theme_file;
                }
                if (!isset($def['path'])) {
                    $def['path'] = $path;
                }
                if (!isset($def['file'])) {
                    $def['file'] = $def['handler'] . '.inc';
                }
                if (!isset($def['parent'])) {
                    $def['parent'] = 'parent';
                }
                // Set the internal name to be able to read it out later.
                $def['name'] = $plugin;
                // Merge the new data in.
                $cache[$type][$plugin] = $def;
            }
        }
    }
    // Let other modules modify the plugins.
    drupal_alter('views_plugins', $cache);
    return $cache;
}