You are here

function quicktabs_ajax in Quick Tabs 7.3

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

Ajax callback for tab content.

Parameters

name The machine name of the quicktabs instance.:

index The tab index we're returning content for.:

type The type of content we're rendering.:

Return value

a json-formatted ajax commands array.

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

File

./quicktabs.module, line 262

Code

function quicktabs_ajax($name, $index, $type) {
  $args = func_get_args();
  $variable_args = array_slice($args, 3);

  // Add the Quicktabs machine name to the args we pass to the content renderer
  array_unshift($variable_args, $name);
  $data = QuickSet::ajaxRenderContent($type, $variable_args);
  $commands = array();
  $tabpage_id = 'quicktabs-tabpage-' . $name . '-' . $index;
  $commands[] = ajax_command_append('#quicktabs-container-' . $name, '<div id="' . $tabpage_id . '" class="quicktabs-tabpage">' . $data . '</div>');
  $page = array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
  ajax_deliver($page);
}