You are here

function js_configure_form in JS Callback Handler 7

Same name and namespace in other branches
  1. 7.2 js.admin.inc \js_configure_form()

Form callback for the js configuration form.

1 string reference to 'js_configure_form'
js_menu in ./js.module
Implements hook_menu().

File

./js.admin.inc, line 10
JavaScript callback handler module.

Code

function js_configure_form($form, &$form_state) {
  $htaccess = '# Rewrite JavaScript callback URLs of the form js.php?q=x.' . PHP_EOL;
  $htaccess .= 'RewriteCond %{REQUEST_URI} ^' . str_replace("/", "\\/", base_path()) . '([a-z]{2}\\/)?js\\/.*' . PHP_EOL;
  $htaccess .= 'RewriteRule ^(.*)$ js.php?q=$1 [L,QSA]' . PHP_EOL;
  $htaccess .= 'RewriteCond %{QUERY_STRING} (^|&)q=((\\/)?[a-z]{2})?(\\/)?js\\/.*' . PHP_EOL;
  $htaccess .= 'RewriteRule .* js.php [L]';
  $form['js_server_software'] = array(
    '#type' => 'select',
    '#options' => array(
      'apache' => 'Apache',
      'other' => t('Other'),
    ),
    '#title' => t('Server software'),
    '#description' => t('The server software for the http server, used to detect if the requirements for the module are met. Set this to other if running on anything other than Apache.'),
    '#default_value' => variable_get('js_server_software', 'apache'),
  );
  $form['htaccess'] = array(
    '#type' => 'textarea',
    '#title' => t('Add the following lines in front of the existing RewriteRules in your .htaccess.'),
    '#value' => $htaccess,
  );
  return system_settings_form($form);
}