You are here

function views_content_views_content_type_content_types in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 views_content/plugins/content_types/views.inc \views_content_views_content_type_content_types()

Return all content types available.

File

views_content/plugins/content_types/views.inc, line 38

Code

function views_content_views_content_type_content_types($plugin) {
  $types = array();

  // It can be fairly intensive to calculate this, so let's cache this in the
  // cache_views table. The nice thing there is that if views ever change, that
  // table will always be cleared. Except for the occasional default view, so
  // we must use the Views caching functions in order to respect Views caching
  // settings.
  views_include('cache');
  $data = views_cache_get('views_content_all', TRUE);
  if (!empty($data->data)) {
    $types = $data->data;
  }
  if (empty($types)) {
    $views = views_get_all_views();
    foreach ($views as $view) {
      if (empty($view->disabled)) {
        $types[$view->name] = _views_content_views_content_type($view);
      }
    }
    views_cache_set('views_content_all', $types, TRUE);
  }
  return $types;
}