function _ccl_views_get_info in Custom Contextual Links 8
Same name and namespace in other branches
- 7 ccl_views/ccl_views.module \_ccl_views_get_info()
Helper function to retrieve all the information for all views in the system.
2 calls to _ccl_views_get_info()
- ccl_views_ccl_link_info in ccl_views/
ccl_views.module - Hook function to provide link option information for the link list page.
- ccl_views_form_ccl_add_form_alter in ccl_views/
ccl_views.module - Implements hook_form_FORM_ID_alter().
File
- ccl_views/
ccl_views.module, line 183 - Implements support of views in CCL.
Code
function _ccl_views_get_info() {
$view_info = \Drupal::cache()
->get('ccl_view_info');
// If no data is found in the cache get all views with
// views_get_applicable_view('handler').
if (empty($view_info)) {
$views = views_get_applicable_views('handler');
if ($views) {
foreach ($views as $key => $view) {
$view['name'] = $view[0]->name;
$view['id'] = $view[1];
$view['human_name'] = $view[0]->human_name;
$view['display_title'] = $view[0]->display[$view[1]]->display_title;
$view['vdid'] = "{$view['name']}|{$view['id']}";
$view['vid'] = $view['name'];
$view['result_display'] = (empty($view['human_name']) ? $view['name'] : $view['human_name']) . " - {$view['display_title']} [{$view['id']}]";
$view['result_view'] = empty($view['human_name']) ? $view['name'] : $view['human_name'];
$view_info['options'] = 0;
$view_info['displays'][$view['vdid']] = $view['result_display'];
$view_info['views'][$view['vid']] = $view['result_view'];
}
\Drupal::cache()
->set('ccl_view_info', $view_info);
}
else {
$view_info['displays'] = array();
$view_info['views'] = array();
}
}
if (isset($view_info->cid)) {
return $view_info->data;
}
else {
return $view_info;
}
}