You are here

function _views_get_default_views in Views (for Drupal 7) 5

Build default view information from all modules and cache it.

7 calls to _views_get_default_views()
views_block in ./views.module
Implementation of hook_block()
views_get_all_urls in ./views.module
Load all of the URLs we use; this is cached in a special manner in an attempt to make the menu system both flexible and yet not overly intensive.
views_get_view in ./views.module
This function loads a view by name or vid; if not found in db, it looks for a default view by that name.
views_menu_standard_items in ./views.module
Add the menu items for all non-inline views to the menu
views_theme_wizard_page in ./views_theme_wizard.module

... See full list

File

./views_cache.inc, line 228

Code

function _views_get_default_views() {
  static $views_default_views;
  global $locale;
  if (!$views_default_views) {
    $data = cache_get("views_default_views:{$locale}", 'cache_views');
    $cache = unserialize($data->data);
    if (is_array($cache)) {
      $views_default_views = $cache;
    }
    else {

      // We have to make sure table data is built in order to be sure about providers.
      $tables = array_keys(_views_get_tables());
      $views = module_invoke_all('views_default_views');
      uasort($views, '_views_sort_arrays');
      $views_default_views = array();
      foreach ($views as $i => $view) {
        if (!is_array($view->requires) || !array_diff($view->requires, $tables)) {
          views_sanitize_view($view);
          $view->is_default = TRUE;
          $views_default_views[$i] = $view;
        }
      }
      cache_set("views_default_views:{$locale}", 'cache_views', serialize($views_default_views));
    }
  }
  return $views_default_views;
}