function eva_get_views

cis7 eva.module eva_get_views($type = NULL, $reset = FALSE)
cle7 eva.module eva_get_views($type = NULL, $reset = FALSE)
elmsmedia7 eva.module eva_get_views($type = NULL, $reset = FALSE)
icor7 eva.module eva_get_views($type = NULL, $reset = FALSE)
meedjum_blog7 eva.module eva_get_views($type = NULL, $reset = FALSE)
mooc7 eva.module eva_get_views($type = NULL, $reset = FALSE)

Get a list of views and displays attached to speficic entities.

This function will cache its results into the views cache, so it gets cleared by Views appropriately.

Parameters

$type: The entity type we want to retrieve views for. If NULL is specified, views for all entity types will be returned.

$reset: Force a rebuild of the data.

Return value

An array of view name/display name values, or an empty array().

2 calls to eva_get_views()
eva_entity_view_alter in sites/all/modules/ulmus/eva/eva.module
Implements hook_entity_view_alter().
eva_field_extra_fields in sites/all/modules/ulmus/eva/eva.module
Implements hook_content_extra_fields().
2 string references to 'eva_get_views'
eva_modules_disabled in sites/all/modules/ulmus/eva/eva.module
Implements hook_modules_disabled().
eva_modules_enabled in sites/all/modules/ulmus/eva/eva.module
Implements hook_modules_enabled().

File

sites/all/modules/ulmus/eva/eva.module, line 109

Code

function eva_get_views($type = NULL, $reset = FALSE) {
  $used_views = &drupal_static(__FUNCTION__);

  if (!isset($used_views) || $reset) {
    views_include('cache');

    // If we're not resetting, check the Views cache.
    if (!$reset) {
      $cache = views_cache_get("eva");
      if (isset($cache->data)) {
        $used_views = $cache->data;
      }
    }

    // If it's still empty rebuild it.
    if (!isset($used_views)) {
      // Trigger a rebuild of the views object cache, which may not be fully loaded.
      ctools_include('export');
      ctools_export_load_object_reset('views_view');

      // Build and cache the data, both in the DB and statically.
      $views = views_get_applicable_views('uses hook entity view');
      foreach ($views as $data) {
        list($view, $display_id) = $data;
        $view_entity = $view->display_handler->get_option('entity_type');
        // Initialize handlers, to determine if the view uses exposed filters.
        $view->init_handlers();
        $used_views[$view_entity][] = array(
          'name' => $view->name,
          'title' => 'EVA: ' . $view->get_human_name() . ' - ' . $view->display[$display_id]->display_title,
          'display' => $display_id,
          'bundles' => $view->display_handler->get_option('bundles'),
          'exposed form' => $view->display_handler->uses_exposed(),
        );
        $view->destroy();
      }
      views_cache_set("eva", $used_views);
    }
  }

  // Now spit back the data.
  if (isset($type) & isset($used_views)) {
    return isset($used_views[$type]) ? $used_views[$type] : array();
  }
  else {
    return isset($used_views) ? $used_views : array();
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.