It would be great if I could specify an arbitrary path as tab content and pull in whatever is returned from the callback for that path. An example use case would be embedding several panels inside of quicktabs so that they could be loaded asynchronously.

CommentFileSizeAuthor
#4 quicktabcallback.patch1.04 KBronnbot

Comments

pasqualle’s picture

Do you mean ajax loading of any page on given path? My guess would be that will not work in the most cases, as many pages require additional js and css, which won't be loaded through the ajax call.. One example is the views page where it certainly does not work..

panels panes should be supported directly, if it is possible. It requires to much input data and it is quite complex: #236925: Panels 3 as tab content

katbailey’s picture

I've added this functionality in the 3.x branch - I need to write up documentation for it but basically you can choose "callback" as your tab type and then specifiy a path, e.g. my/callback/path. Then your menu callback function will do something like this:

function my_qt_tab_callback($type = 'normal') {
  $content = get_my_content_from_somewhere();
  
  if ($type == 'normal') {
    return $content;
  }
  else {
    $response = quicktabs_ajax_wrap($content);
    drupal_json(array('status' => 0, 'data' => $response));
  }
}

What quicktabs_ajax_wrap() does is ensure that all js and css gets lazy loaded for the ajax content and returns an array that is correctly structured for the quicktabs ajax success function on the js side.
Please test :-)

ezra-g’s picture

Awesome - thanks!

I'm not actively using Quicktabs at the moment, but will definitely be back to test this (and encourage some folks on a project to use it instead of their custom solution ; ) .

Great stuff here.

ronnbot’s picture

StatusFileSize
new1.04 KB

Here's a patch that would not necessitate rewriting a menu callback for compatibility with quicktabs ajax functionality; therefore, allowing utilization of any existing menu callback.

katbailey’s picture

Status: Active » Fixed

Thanks Ronn - that's much nicer :-)
Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

laz0rama’s picture

Category: feature » support
Issue tags: +quicktags callback

hi, i am trying to use a callback for the quicktabs content, but i cannot figure out how. my problem might be that i am not all that familiar with menu callbacks.

i have a module, call it pacpar. i have created a callback function named "pacpar_qt_load_tab_0", whose intent should be clear. in the quicktabs admin, for that tab, what do i put in the "callback path" field for that tab? also, do i need to add something to my pacpar_menu() hook? if so, what exactly?

sorry for seeming such a newbie, i am only a newbie to the menu callback system.

thanks for any help!