You are here

function quicktabs_block_edit in Quick Tabs 6

Same name and namespace in other branches
  1. 5 quicktabs.module \quicktabs_block_edit()
1 string reference to 'quicktabs_block_edit'
quicktabs_menu in ./quicktabs.module
Implementation of hook_menu().

File

./quicktabs.module, line 616

Code

function quicktabs_block_edit($qtid) {
  if ($qtblock = db_fetch_object(db_query('SELECT title, tabs FROM {quicktabs} WHERE qtid = %d', $qtid))) {
    $tabs = unserialize($qtblock->tabs);
    $formtabs = array();
    foreach ($tabs as $key => $tab) {
      $weight[$key] = $tab['weight'];
      $formtabs[] = array(
        'tabweight' => $tab['weight'],
        'tabtext' => $tab['title'],
        'tabtype' => $tab['type'],
        'bid' => $tab['type'] == 'block' ? $tab['bvid'] : NULL,
        'hide_title' => $tab['type'] == 'block' ? $tab['hide_title'] : NULL,
        'vid' => $tab['type'] == 'view' ? $tab['bvid'] : NULL,
        'args' => $tab['type'] == 'view' ? $tab['args'] : NULL,
        'display' => $tab['type'] == 'view' ? $tab['display'] : NULL,
      );
    }
    array_multisort($weight, SORT_ASC, $formtabs);
    $quicktabs = array(
      'qtid' => $qtid,
      'title' => $qtblock->title,
      'tabs' => $formtabs,
      'formtype' => 'edit',
    );
    drupal_add_js(drupal_get_path('module', 'quicktabs') . '/js/quicktabs_form.js');
    drupal_add_css(drupal_get_path('module', 'quicktabs') . '/quicktabs.css');
    $output = drupal_get_form('quicktabs_form', $quicktabs);
    return $output;
  }
  else {
    drupal_goto('admin/build/quicktabs');
  }
}