Skip to main content
2 of 2
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/

Prorgrammatically generated quicktab does not display content

I have programmatically created a quicktab but the contents of the tab do not display. I have followed the instructions and have looked at this related question but it does not work for me. I suspect I must be missing something simple. Here is the code for creating the quicktab:

function create_quicktabs() {

  $block_ids = array(
    'Books & Journals' => 'books_journals_search',
    'Articles' => 'articles_search',
    'Archives' => 'archives_search',
    'Databases' => 'databases_search',
    'Course Reserves' => 'course_reserves_search',
    'Institution Repository' => 'repository_search',
  );

  $tabs = array();
  foreach ($block_ids as $title => $block_delta) {
    $block = block_load('catalogue_search', $block_delta);
    $tabs[] = array(
      'title' => t($title),
      'type' => 'block',
      'bid' => $block->bid,
      'hide_title' => TRUE,
    );
  }

  // Configure the QuickTabs options
  $quicktabs_options = array(
    'style' => 'Bullets',
    'ajax' => FALSE,
    'sorted' => FALSE,
  );

  $quicktabs_name = 'catalogue_search';
  $quicktabs = quicktabs_build_quicktabs($quicktabs_name, $quicktabs_options, $tabs);
  return $quicktabs;
}

I get no errors when this is run, but it seems as though quicktabs can't find the block to display. I have verified that the blocks do exist and the block ids are valid. I have also tried using block_delta for the bid value - again same result. This is for Drupal 7 by the way. What am I doing wrong?

user5013
  • 1.5k
  • 2
  • 29
  • 55