Same name in other branches
  1. 7.x-2.x quicktabs.module \quicktabs_ajax()
  2. 7.x-3.x 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.

File

./quicktabs.module, line 192

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);
}