You are here

function _quicktabs_convert_form_to_quicktabs in Quick Tabs 7.3

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

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

2 calls to _quicktabs_convert_form_to_quicktabs()
quicktabs_form_submit in ./quicktabs.admin.inc
Submit handler for quicktabs admin page.
_quicktabs_admin_main_form in ./quicktabs.admin.inc
The main section of admin page.

File

./quicktabs.admin.inc, line 629
Provides the Quicktabs administrative interface.

Code

function _quicktabs_convert_form_to_quicktabs($form_state) {
  $formvalues_tabs = array();
  if (!empty($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);
  }
  $renderer = $form_state['values']['renderer'];
  $qt = new stdClass();
  $qt->title = $form_state['values']['title'];
  $qt->ajax = $form_state['values']['ajax'];
  $qt->default_tab = isset($form_state['values']['default_tab']) ? $form_state['values']['default_tab'] : 0;
  $qt->hide_empty_tabs = $form_state['values']['hide_empty_tabs'];
  $qt->renderer = $renderer;
  $qt->style = $form_state['values']['style'];
  $qt->tabs = $formvalues_tabs;
  $qt->options = isset($form_state['values']['options'][$renderer]) ? $form_state['values']['options'][$renderer] : array();
  if (isset($form_state['values']['machine_name'])) {
    $qt->machine_name = $form_state['values']['machine_name'];
  }
  return $qt;
}