You are here

function quicktabs_form_submit in Quick Tabs 5

Same name and namespace in other branches
  1. 6.3 includes/admin.inc \quicktabs_form_submit()
  2. 6 quicktabs.module \quicktabs_form_submit()
  3. 6.2 includes/admin.inc \quicktabs_form_submit()
  4. 7.3 quicktabs.admin.inc \quicktabs_form_submit()
  5. 7.2 includes/admin.inc \quicktabs_form_submit()

File

./quicktabs.module, line 414

Code

function quicktabs_form_submit($form_id, $form_values) {
  if ($form_values['op'] == t('Submit')) {
    $formvalues_tabs = array();
    foreach ($form_values['tabs'] as $i => $tab) {
      $formvalues_tabs[] = array(
        'title' => $tab['tabtext'],
        'type' => $tab['tabtype'],
        'weight' => $tab['tabweight'],
        'bvid' => $tab['tabtype'] == 'block' ? $tab['bid'] : $tab['vid'],
        'args' => $tab['tabtype'] == 'block' ? '' : $tab['args'],
        'limit' => $tab['tabtype'] == 'block' ? '0' : $tab['limit'],
        'build' => $tab['tabtype'] == 'block' ? '' : $tab['build'],
      );
    }
    $fullcontent = array(
      'blocktitle' => $form_values['title'],
      'blockcontent' => $formvalues_tabs,
    );
    if ($form_values['formtype'] == 'edit') {
      $qtid = $form_values['qtid'];
      quicktabs_updateblock($qtid, $fullcontent);
      $msg = t('Your Quick Tabs block has been updated.');
    }
    else {
      quicktabs_createblock($fullcontent);
      $msg = t('Your Quick Tabs block has been created and can now be enabled.');
    }
    drupal_set_message($msg);
    return 'admin/build/block';
  }
}