You are here

function og_get_available_views in Organic groups 5.2

Same name and namespace in other branches
  1. 5.8 og.module \og_get_available_views()
  2. 5 og.module \og_get_available_views()
  3. 5.3 og.module \og_get_available_views()
  4. 5.7 og.module \og_get_available_views()
1 call to og_get_available_views()
og_admin_settings in ./og.module

File

./og.module, line 2394

Code

function og_get_available_views() {
  $views = array();
  $result = db_query("SELECT name, description FROM {view_view} WHERE name LIKE 'og_ghp_%'");
  while ($view = db_fetch_object($result)) {
    $views[$view->name] = check_plain("{$view->description} ({$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) {

    // filter this list to simplify for admins.
    if (substr($view->name, 0, 7) == 'og_ghp_') {
      if (!$views[$view->name] && ($views_status[$view->name] == 'enabled' || !$views_status[$view->name] && !$view->disabled)) {
        $views[$view->name] = check_plain("{$view->description} ({$view->name})");
      }
    }
  }
  ksort($views);
  return $views;
}