You are here

function _quicktabs_prepare_views in Quick Tabs 7.2

Same name and namespace in other branches
  1. 6.3 quicktabs.module \_quicktabs_prepare_views()
  2. 6.2 quicktabs.module \_quicktabs_prepare_views()

Helper function to add views settings to ajax tabs.

File

./quicktabs.module, line 641

Code

function _quicktabs_prepare_views($tabs) {
  if (module_exists('views')) {
    views_add_js('ajax_view');
    views_add_css('views');
    foreach ($tabs as $key => $tab) {
      if ($tab['type'] == 'view') {

        // We need to pass view details to js in case there is ajax paging.
        $settings = array(
          'views' => array(
            'ajax_path' => url('views/ajax'),
            'ajaxViews' => array(
              array(
                'view_name' => $tab['vid'],
                'view_display_id' => $tab['display'],
                'view_args' => implode('/', $tab['args']),
                'view_path' => $_GET['q'],
              ),
            ),
          ),
        );
        drupal_add_js($settings, 'setting');
      }
    }
  }
}