You are here

function views_get_all_views in Views (for Drupal 7) 6.3

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

Return an array of all views as fully loaded $view objects.

Parameters

$reset: If TRUE, reset the static cache forcing views to be reloaded.

10 calls to views_get_all_views()
drush_views_analyze in drush/views.drush.inc
drush_views_list in drush/views.drush.inc
Callback function for views-list command.
template_preprocess_views_ui_list_views in includes/admin.inc
Preprocess the list views theme
ViewsSqlTest::enableViewsUi in tests/views_query.test
This function allows to enable views ui from a higher class which can't change the setup function anymore.
views_block in ./views.module
Implementation of hook_block

... See full list

File

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

Code

function views_get_all_views($reset = FALSE) {
  static $views = array();
  if (empty($views) || $reset) {
    $views = array();

    // First, get all applicable views.
    views_include('view');
    $views = view::load_views();

    // Get all default views.
    $status = variable_get('views_defaults', array());
    foreach (views_discover_default_views($reset) as $view) {

      // Determine if default view is enabled or disabled.
      if (isset($status[$view->name])) {
        $view->disabled = $status[$view->name];
      }

      // If overridden, also say so.
      if (!empty($views[$view->name])) {
        $views[$view->name]->type = t('Overridden');
      }
      else {
        $view->type = t('Default');
        $views[$view->name] = $view;
      }
    }
  }
  return $views;
}