function _nodehierarchy_views_get_embed_views in Node Hierarchy 7.4
Get a list of views that can be embedded.
1 call to _nodehierarchy_views_get_embed_views()
- _nodehierarchy_views_view_options in nodehierarchy_views/
nodehierarchy_views.module - Prepare a list of views for selection.
File
- nodehierarchy_views/
nodehierarchy_views.module, line 296 - Embed a view of children onto a node.
Code
function _nodehierarchy_views_get_embed_views($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("nodehierarchy_views");
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('nodehierarchy embed view');
foreach ($views as $data) {
list($view, $display_id) = $data;
$tile = $view->display_handler
->get_option('nodehierarchy_embed_admin_name');
if (empty($tile)) {
$tile = $view
->get_human_name() . ' - ' . $view->display[$display_id]->display_title;
}
$used_views[] = array(
'name' => $view->name,
'display' => $display_id,
'title' => $tile,
);
$view
->destroy();
}
views_cache_set("nodehierarchy_views", $used_views);
}
}
return isset($used_views) ? $used_views : array();
}