You are here

function libraries_cdn_ui_browser in Libraries CDN API 7

1 string reference to 'libraries_cdn_ui_browser'
libraries_cdn_ui_admin_page_callback in modules/libraries_cdn_ui/libraries_cdn_ui.admin.inc
Callback for the cdn page

File

modules/libraries_cdn_ui/libraries_cdn_ui.admin.inc, line 11

Code

function libraries_cdn_ui_browser($form, &$form_state) {
  if (!isset($form_state['stage'])) {
    $form_state['stage'] = 'step1';
  }
  $form = array();
  $form['#tree'] = TRUE;
  $form_state['stage'] = isset($form_state['stage']) ? $form_state['stage'] : 1;
  $form_stages = array(
    'step1' => 1,
    'step2' => 2,
    'step3' => 3,
    'step4' => 4,
  );
  if (isset($form_stages[$form_state['stage']])) {
    $current_step = $form_stages[$form_state['stage']];
  }
  else {
    $current_step = 1;
  }
  $stages = array(
    1 => array(
      'data' => 'Choose the library',
    ),
    2 => array(
      'data' => 'Select the version and files',
    ),
    3 => array(
      'data' => 'Review your choice',
    ),
    4 => array(
      'data' => 'Submit',
    ),
  );
  $stages[$current_step]['class'] = array(
    'active',
  );
  $form['header'] = array(
    '#type' => 'item',
    '#description' => $stages[$current_step]['data'],
    '#title' => 'Step ' . $current_step,
  );
  switch ($form_state['stage']) {
    case 'step1':
      return libraries_cdn_ui_browser_step1($form, $form_state);
      break;
    case 'step2':
      return libraries_cdn_ui_browser_step2($form, $form_state);
      break;
    case 'step3':
      return libraries_cdn_ui_browser_step3($form, $form_state);
      break;
    case 'step4':
      return libraries_cdn_ui_browser_step4($form, $form_state);
      break;
  }
  return $form;
}