You are here

function views_module_include in Views (for Drupal 7) 8.3

Same name and namespace in other branches
  1. 6.3 views.module \views_module_include()
  2. 6.2 views.module \views_module_include()
  3. 7.3 views.module \views_module_include()

Load views files on behalf of modules.

@todo Remove this function once the views integration got moved into the core modules itself.

1 call to views_module_include()
views_include_handlers in ./views.module
Load views files on behalf of modules.

File

./views.module, line 1184
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_module_include() {
  $loaded_files =& drupal_static(__FUNCTION__, array());
  $minimum_version = views_api_minimum_version();
  $current_version = views_api_version();
  foreach (module_implements('views_api') as $module) {
    if (isset($loaded_files[$module])) {
      continue;
    }
    $info = module_invoke($module, 'views_api');
    $version = $info['api'];
    $path = isset($info['path']) ? $info['path'] : drupal_get_path('module', $module);

    // Only process if version is between minimum and current, inclusive.
    if (version_compare($version, $minimum_version, '>=') && version_compare($version, $current_version, '<=')) {
      $path = $path . "/{$module}.views.inc";
      if (file_exists($path)) {
        include_once $path;
        $loaded_files[$module] = TRUE;
      }
    }
  }
}