You are here

function jqp_confirm_form in jQuery Plugin Handler (JQP) 6.2

Wrapper function for all actions which needs confirmation before execution.

1 string reference to 'jqp_confirm_form'
jqp_menu in ./jqp.module
Implementation of hook_menu().

File

./jqp.admin.inc, line 304
This file includes all functionality for the libraries configuration pages

Code

function jqp_confirm_form(&$form_state, $js_library = NULL, $version = 0) {
  $form['js_library'] = array(
    '#type' => 'value',
    '#value' => $js_library,
  );
  $form['version'] = array(
    '#type' => 'value',
    '#value' => $version,
  );
  $form['file'] = array(
    '#type' => 'value',
    '#value' => $_GET['file'],
  );
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $_GET['type'],
  );
  if (isset($js_library, $version, $_GET['file'], $_GET['type'])) {
    return confirm_form($form, t('Are you sure you want to remove the file %item from %library', array(
      '%item' => $_GET['file'],
      '%library' => $js_library->info['name'],
    )), "admin/build/jqp/{$js_library->name}/{$version}", t('Removal of this file only applies to version !version of this library.', array(
      '!version' => $version,
    )), t('Remove'));
  }
  elseif (isset($js_library, $version)) {
    return confirm_form($form, t('Are you sure you want to reset the item %item to its default values?', array(
      '%item' => $js_library->info['name'],
    )), "admin/build/jqp/{$js_library->name}/{$version}", t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
  }
  elseif (arg(3) == 'rebuild_confirm') {
    $form = array(
      'reset_all' => array(
        '#type' => 'value',
        '#value' => TRUE,
      ),
    );
    return confirm_form($form, t('Are you sure you want to completely rebuild all javascript libraries?'), "admin/build/jqp", t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
  }
  else {
    drupal_goto('admin/build/jqp');
  }
}