You are here

function _context_ui_contrib_get_views in Context 5

Helper function to generate a list of database and module provided views.

1 call to _context_ui_contrib_get_views()
context_ui_contrib_context_items in context_ui/context_ui_contrib.module
Implementation of hook_context_items()

File

context_ui/context_ui_contrib.module, line 87

Code

function _context_ui_contrib_get_views() {
  $views = array();
  $result = db_query("SELECT name FROM {view_view}");
  while ($view = db_fetch_object($result)) {
    $views[$view->name] = $view->name;
  }
  views_load_cache();

  // the function below was not loaded without this call
  $default_views = _views_get_default_views();
  $views_status = variable_get('views_defaults', array());
  foreach ($default_views as $view) {
    if (!$views[$view->name] && ($views_status[$view->name] == 'enabled' || !$views_status[$view->name] && !$view->disabled)) {
      $views[$view->name] = $view->name;
    }
  }
  ksort($views);
  return $views;
}