You are here

function quicktabs_ajax in Quick Tabs 7.2

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

Ajax callback for tab content.

1 string reference to 'quicktabs_ajax'
quicktabs_menu in ./quicktabs.module
Implements hook_menu().

File

./quicktabs.module, line 314

Code

function quicktabs_ajax($type) {
  $args = func_get_args();
  $type = array_shift($args);
  $tabpage = array(
    'type' => $type,
  );
  switch ($type) {
    case 'node':
      list($tabpage['nid'], $tabpage['teaser'], $tabpage['hide_title']) = $args;
      break;
    case 'block':
      list($tabpage['qt_name'], $tabpage['bid'], $tabpage['hide_title']) = $args;
      break;
    case 'qtabs':
      $tabpage['machine_name'] = $args[0];
      break;
  }
  $output = quicktabs_render_tab_content($tabpage);
  $data = !empty($output) ? drupal_render($output) : '';
  drupal_json_output(array(
    'status' => 0,
    'data' => $data,
  ));
}