You are here

function _quicktabs_build_content_view in Quick Tabs 7.2

File

./quicktabs.module, line 367

Code

function _quicktabs_build_content_view($tab, $hide_empty = FALSE) {
  $output = array();
  if (isset($tab['vid'])) {
    if (module_exists('views')) {
      if ($view = views_get_view($tab['vid'])) {
        if ($view
          ->access($tab['display'])) {
          $view
            ->set_display($tab['display']);
          $view
            ->set_arguments($tab['args']);
          $view_output = $view
            ->preview();
          if (!empty($view->result) || $view->display_handler
            ->get_option('empty') || !empty($view->style_plugin->definition['even empty'])) {
            $output['#markup'] = $view_output;
          }
        }
        elseif (!$hide_empty) {
          $output['#markup'] = theme('quicktabs_tab_access_denied', array(
            'tab' => $tab,
          ));
        }
        $view
          ->destroy();
      }
    }
    elseif (!$hide_empty) {
      $output['#markup'] = t('Views module is not enabled, cannot display tab content.');
    }
  }
  return $output;
}