You are here

function _quicktabs_convert_form_to_quicktabs in Quick Tabs 6.2

Same name and namespace in other branches
  1. 6.3 includes/admin.inc \_quicktabs_convert_form_to_quicktabs()
  2. 7.3 quicktabs.admin.inc \_quicktabs_convert_form_to_quicktabs()

Helper function to convert the data on admin form into quicktabs presentation.

4 calls to _quicktabs_convert_form_to_quicktabs()
qt_get_displays_submit in includes/admin.inc
Submit handler for the Views drop down.
qt_more_tabs_submit in includes/admin.inc
Submit handler for the "Add Tab" button.
qt_remove_tab_submit in includes/admin.inc
Submit handler for the "Remove Tab" button.
quicktabs_form_submit in includes/admin.inc
Submit handler for quicktabs admin page.

File

includes/admin.inc, line 651

Code

function _quicktabs_convert_form_to_quicktabs($form_state) {
  $formvalues_tabs = array();
  if (isset($form_state['values']['tabs'])) {
    foreach ($form_state['values']['tabs'] as $j => $tab) {
      $formvalues_tabs[$j] = $tab[$tab['type']];
      $formvalues_tabs[$j]['title'] = $tab['title'];
      $formvalues_tabs[$j]['weight'] = $tab['weight'];
      $formvalues_tabs[$j]['type'] = $tab['type'];
      $weight[$j] = $tab['weight'];
    }
    array_multisort($weight, SORT_ASC, $formvalues_tabs);
  }
  $quicktabs = array(
    'title' => $form_state['values']['title'],
    'ajax' => $form_state['values']['ajax'],
    'hide_empty_tabs' => $form_state['values']['hide_empty_tabs'],
    'default_tab' => isset($form_state['values']['default_tab']) ? $form_state['values']['default_tab'] : 0,
    'style' => $form_state['values']['style'],
    'tabs' => $formvalues_tabs,
  );
  if (isset($form_state['values']['qtid'])) {
    $quicktabs['qtid'] = $form_state['values']['qtid'];
  }
  else {
    $quicktabs['qtid'] = 0;
  }
  return $quicktabs;
}