function _popup_view in Popup 8
Same name and namespace in other branches
- 7 includes/popup.api.inc \_popup_view()
- 7.x includes/popup.api.inc \_popup_view()
- 6.x includes/popup.api.inc \_popup_view()
File
- includes/
popup.api.inc, line 410
Code
function _popup_view($attributes, $return = FALSE) {
$title = FALSE;
$body = FALSE;
if (module_exists('views')) {
$view = views_get_view($attributes['view']);
$display = $attributes['display'] ? $attributes['display'] : 'default';
$args = isset($attributes['args']) ? explode(',', $attributes['args']) : array();
if ($view) {
$view
->set_arguments($args);
$view
->set_display($display);
$body = $view
->preview();
$computed_title = $view
->get_title();
$title = $attributes['title'] ? $attributes['title'] : ($computed_title ? $computed_title : @$view->display[$display]->display_options['title']);
}
}
else {
$body = false;
}
$title = $title ? $title : 'View';
if ($return == 'title') {
return $title;
}
if ($return == 'body') {
return $body;
}
return popup_element($title, $body, $attributes);
}