You are here

function jquery_update_settings_form in jQuery Update 7.2

Same name and namespace in other branches
  1. 7.3 jquery_update.admin.inc \jquery_update_settings_form()

Admin settings menu callback.

See also

jquery_update_menu()

1 string reference to 'jquery_update_settings_form'
jquery_update_menu in ./jquery_update.module
Implements hook_menu().

File

./jquery_update.module, line 169
Updates Drupal to use the latest version of jQuery.

Code

function jquery_update_settings_form() {
  $form['version_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Version options'),
  );
  $form['version_options']['jquery_update_jquery_version'] = array(
    '#type' => 'select',
    '#title' => t('Default jQuery Version'),
    '#options' => array(
      'default' => t('Default (provided by Drupal)'),
      '1.5' => '1.5',
      '1.7' => '1.7',
      '1.8' => '1.8',
      '1.9' => '1.9',
      '1.10' => '1.10',
    ),
    '#default_value' => variable_get('jquery_update_jquery_version', '1.10'),
    '#description' => t('Select which jQuery version to use by default.'),
  );
  $form['version_options']['jquery_update_jquery_admin_version'] = array(
    '#type' => 'select',
    '#title' => t('Alternate jQuery version for administrative pages'),
    '#options' => array(
      '' => t('Default jQuery Version'),
      'default' => t('Default (provided by Drupal)'),
      '1.5' => '1.5',
      '1.7' => '1.7',
      '1.8' => '1.8',
      '1.10' => '1.10',
    ),
    '#default_value' => variable_get('jquery_update_jquery_admin_version', ''),
    '#description' => t('Optionally select a different version of jQuery to use on administrative pages.'),
  );
  $form['jquery_update_compression_type'] = array(
    '#type' => 'radios',
    '#title' => t('jQuery compression level'),
    '#options' => array(
      'min' => t('Production (minified)'),
      'none' => t('Development (uncompressed)'),
    ),
    // Do not show this field if jQuery version is default
    '#states' => array(
      'invisible' => array(
        ':input[name=jquery_update_jquery_version]' => array(
          'value' => "default",
        ),
      ),
    ),
    '#default_value' => variable_get('jquery_update_compression_type', 'min'),
  );
  $form['jquery_update_jquery_cdn'] = array(
    '#type' => 'select',
    '#title' => t('jQuery and jQuery UI CDN'),
    '#options' => array(
      'none' => t('None'),
      'google' => t('Google'),
      'microsoft' => t('Microsoft'),
      'jquery' => t('jQuery'),
    ),
    // Do not show this field if jQuery version is default
    '#states' => array(
      'invisible' => array(
        ':input[name=jquery_update_jquery_version]' => array(
          'value' => "default",
        ),
      ),
    ),
    '#default_value' => variable_get('jquery_update_jquery_cdn', 'none'),
    '#description' => t('Use jQuery and jQuery UI from a CDN. If the CDN is not available the local version of jQuery and jQuery UI will be used.'),
  );
  return system_settings_form($form);
}