Projet

Général

Profil

Paste
Télécharger (28,6 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / bootstrap / theme-settings.php @ ec2b0e7b

1
<?php
2
/**
3
 * @file
4
 * theme-settings.php
5
 *
6
 * Provides theme settings for Bootstrap based themes when admin theme is not.
7
 *
8
 * @see ./includes/settings.inc
9
 */
10

    
11
/**
12
 * Include common Bootstrap functions.
13
 */
14
include_once dirname(__FILE__) . '/includes/common.inc';
15
bootstrap_include('bootstrap', 'includes/cdn.inc');
16

    
17
/**
18
 * Implements hook_form_FORM_ID_alter().
19
 */
20
function bootstrap_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL) {
21
  // Do not add Bootstrap specific settings to non-bootstrap based themes,
22
  // including a work-around for a core bug affecting admin themes.
23
  // @see https://drupal.org/node/943212
24
  $theme = !empty($form_state['build_info']['args'][0]) ? $form_state['build_info']['args'][0] : FALSE;
25
  if (isset($form_id) || $theme === FALSE || !in_array('bootstrap', _bootstrap_get_base_themes($theme, TRUE))) {
26
    return;
27
  }
28

    
29
  // Display a warning if jQuery Update isn't enabled or using a lower version.
30
  if (!bootstrap_setting('toggle_jquery_error', $theme) || !module_exists('jquery_update')) {
31
    // Get theme specific jQuery version.
32
    $jquery_version = theme_get_setting('jquery_update_jquery_version', $theme);
33

    
34
    // Get site wide jQuery version if theme specific one is not set.
35
    if (!$jquery_version) {
36
      $jquery_version = variable_get('jquery_update_jquery_version', '1.10');
37
    }
38

    
39
    // Ensure the jQuery version is >= 1.9.
40
    if (!$jquery_version || !version_compare($jquery_version, '1.9', '>=')) {
41
      $message = t('jQuery Update is not enabled, Bootstrap requires a minimum jQuery version of 1.9 or higher. Please enable the <a href="!jquery_update_project_url">jQuery Update</a> module. If you are seeing this message, then you must <a href="!jquery_update_configure">manually configuration</a> this setting or optionally <a href="!bootstrap_suppress_jquery_error">suppress this message</a> instead.', array(
42
        '!jquery_update_project_url' => check_plain('https://www.drupal.org/project/jquery_update'),
43
        '!jquery_update_configure' => check_plain(url('admin/config/development/jquery_update')),
44
        '!bootstrap_suppress_jquery_error' => check_plain(url('admin/appearance/settings/' . $theme, array(
45
          'fragment' => 'edit-bootstrap-toggle-jquery-error',
46
        ))),
47
      ));
48
      drupal_set_message($message, 'error', FALSE);
49
    }
50
  }
51

    
52
  // Create vertical tabs for all Bootstrap related settings.
53
  $form['bootstrap'] = array(
54
    '#type' => 'vertical_tabs',
55
    '#attached' => array(
56
      'js'  => array(drupal_get_path('theme', 'bootstrap') . '/js/bootstrap.admin.js'),
57
    ),
58
    '#prefix' => '<h2><small>' . t('Bootstrap Settings') . '</small></h2>',
59
    '#weight' => -10,
60
  );
61

    
62
  // General.
63
  $form['general'] = array(
64
    '#type' => 'fieldset',
65
    '#title' => t('General'),
66
    '#group' => 'bootstrap',
67
  );
68

    
69
  //Container
70
  $form['general']['container'] = array(
71
    '#type' => 'fieldset',
72
    '#title' => t('Container'),
73
    '#collapsible' => TRUE,
74
    '#collapsed' => TRUE,
75
  );
76
  $form['general']['container']['bootstrap_fluid_container'] = array(
77
    '#type' => 'checkbox',
78
    '#title' => t('Fluid container'),
79
    '#default_value' => bootstrap_setting('fluid_container', $theme),
80
    '#description' => t('Use <code>.container-fluid</code> class. See <a href="!url">Fluid container</a>', array(
81
      '!url' => 'http://getbootstrap.com/css/#grid-example-fluid',
82
    )),
83
  );
84

    
85
  // Buttons.
86
  $form['general']['buttons'] = array(
87
    '#type' => 'fieldset',
88
    '#title' => t('Buttons'),
89
    '#collapsible' => TRUE,
90
    '#collapsed' => TRUE,
91
  );
92
  $form['general']['buttons']['bootstrap_button_size'] = array(
93
    '#type' => 'select',
94
    '#title' => t('Default button size'),
95
    '#default_value' => bootstrap_setting('button_size', $theme),
96
    '#empty_option' => t('Normal'),
97
    '#options' => array(
98
      'btn-xs' => t('Extra Small'),
99
      'btn-sm' => t('Small'),
100
      'btn-lg' => t('Large'),
101
    ),
102
  );
103
  $form['general']['buttons']['bootstrap_button_colorize'] = array(
104
    '#type' => 'checkbox',
105
    '#title' => t('Colorize Buttons'),
106
    '#default_value' => bootstrap_setting('button_colorize', $theme),
107
    '#description' => t('Adds classes to buttons based on their text value. See: <a href="!bootstrap_url" target="_blank">Buttons</a> and <a href="!api_url" target="_blank">hook_bootstrap_colorize_text_alter()</a>', array(
108
      '!bootstrap_url' => 'http://getbootstrap.com/css/#buttons',
109
      '!api_url' => 'http://drupal-bootstrap.org/apis/hook_bootstrap_colorize_text_alter',
110
    )),
111
  );
112
  $form['general']['buttons']['bootstrap_button_iconize'] = array(
113
    '#type' => 'checkbox',
114
    '#title' => t('Iconize Buttons'),
115
    '#default_value' => bootstrap_setting('button_iconize', $theme),
116
    '#description' => t('Adds icons to buttons based on the text value. See: <a href="!api_url" target="_blank">hook_bootstrap_iconize_text_alter()</a>', array(
117
      '!api_url' => 'http://drupal-bootstrap.org/apis/hook_bootstrap_iconize_text_alter',
118
    )),
119
  );
120

    
121
  // Forms.
122
  $form['general']['forms'] = array(
123
    '#type' => 'fieldset',
124
    '#title' => t('Forms'),
125
    '#collapsible' => TRUE,
126
    '#collapsed' => TRUE,
127
  );
128
  $form['general']['forms']['bootstrap_forms_required_has_error'] = array(
129
    '#type' => 'checkbox',
130
    '#title' => t('Make required elements display as an error'),
131
    '#default_value' => bootstrap_setting('forms_required_has_error', $theme),
132
    '#description' => t('If an element in a form is required, enabling this will always display the element with a <code>.has-error</code> class. This turns the element red and helps in usability for determining which form elements are required to submit the form.  This feature compliments the "JavaScript > Forms > Automatically remove error classes when values have been entered" feature.'),
133
  );
134
  $form['general']['forms']['bootstrap_forms_smart_descriptions'] = array(
135
    '#type' => 'checkbox',
136
    '#title' => t('Smart form descriptions (via Tooltips)'),
137
    '#description' => t('Convert descriptions into tooltips (must be enabled) automatically based on certain criteria. This helps reduce the, sometimes unnecessary, amount of noise on a page full of form elements.'),
138
    '#default_value' => bootstrap_setting('forms_smart_descriptions', $theme),
139
  );
140
  $form['general']['forms']['bootstrap_forms_smart_descriptions_limit'] = array(
141
    '#type' => 'textfield',
142
    '#title' => t('"Smart form descriptions" maximum character limit'),
143
    '#description' => t('Prevents descriptions from becoming tooltips by checking the character length of the description (HTML is not counted towards this limit). To disable this filtering criteria, leave an empty value.'),
144
    '#default_value' => bootstrap_setting('forms_smart_descriptions_limit', $theme),
145
    '#states' => array(
146
      'visible' => array(
147
        ':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE),
148
      ),
149
    ),
150
  );
151
  $form['general']['forms']['bootstrap_forms_smart_descriptions_allowed_tags'] = array(
152
    '#type' => 'textfield',
153
    '#title' => t('"Smart form descriptions" allowed (HTML) tags'),
154
    '#description' => t('Prevents descriptions from becoming tooltips by checking for HTML not in the list above (i.e. links). Separate by commas. To disable this filtering criteria, leave an empty value.'),
155
    '#default_value' => bootstrap_setting('forms_smart_descriptions_allowed_tags', $theme),
156
    '#states' => array(
157
      'visible' => array(
158
        ':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE),
159
      ),
160
    ),
161
  );
162

    
163
  // Images.
164
  $form['general']['images'] = array(
165
    '#type' => 'fieldset',
166
    '#title' => t('Images'),
167
    '#collapsible' => TRUE,
168
    '#collapsed' => TRUE,
169
  );
170
  $form['general']['images']['bootstrap_image_shape'] = array(
171
    '#type' => 'select',
172
    '#title' => t('Default image shape'),
173
    '#description' => t('Add classes to an <code>&lt;img&gt;</code> element to easily style images in any project. Note: Internet Explorer 8 lacks support for rounded corners. See: <a href="!bootstrap_url" target="_blank">Image Shapes</a>', array(
174
      '!bootstrap_url' => 'http://getbootstrap.com/css/#images-shapes',
175
    )),
176
    '#default_value' => bootstrap_setting('image_shape', $theme),
177
    '#empty_option' => t('None'),
178
    '#options' => array(
179
      'img-rounded' => t('Rounded'),
180
      'img-circle' => t('Circle'),
181
      'img-thumbnail' => t('Thumbnail'),
182
    ),
183
  );
184
  $form['general']['images']['bootstrap_image_responsive'] = array(
185
    '#type' => 'checkbox',
186
    '#title' => t('Responsive Images'),
187
    '#default_value' => bootstrap_setting('image_responsive', $theme),
188
    '#description' => t('Images in Bootstrap 3 can be made responsive-friendly via the addition of the <code>.img-responsive</code> class. This applies <code>max-width: 100%;</code> and <code>height: auto;</code> to the image so that it scales nicely to the parent element.'),
189
  );
190

    
191
  // Tables.
192
  $form['general']['tables'] = array(
193
    '#type' => 'fieldset',
194
    '#title' => t('Tables'),
195
    '#collapsible' => TRUE,
196
    '#collapsed' => TRUE,
197
  );
198
  $form['general']['tables']['bootstrap_table_bordered'] = array(
199
    '#type' => 'checkbox',
200
    '#title' => t('Bordered table'),
201
    '#default_value' => bootstrap_setting('table_bordered', $theme),
202
    '#description' => t('Add borders on all sides of the table and cells.'),
203
  );
204
  $form['general']['tables']['bootstrap_table_condensed'] = array(
205
    '#type' => 'checkbox',
206
    '#title' => t('Condensed table'),
207
    '#default_value' => bootstrap_setting('table_condensed', $theme),
208
    '#description' => t('Make tables more compact by cutting cell padding in half.'),
209
  );
210
  $form['general']['tables']['bootstrap_table_hover'] = array(
211
    '#type' => 'checkbox',
212
    '#title' => t('Hover rows'),
213
    '#default_value' => bootstrap_setting('table_hover', $theme),
214
    '#description' => t('Enable a hover state on table rows.'),
215
  );
216
  $form['general']['tables']['bootstrap_table_striped'] = array(
217
    '#type' => 'checkbox',
218
    '#title' => t('Striped rows'),
219
    '#default_value' => bootstrap_setting('table_striped', $theme),
220
    '#description' => t('Add zebra-striping to any table row within the <code>&lt;tbody&gt;</code>. <strong>Note:</strong> Striped tables are styled via the <code>:nth-child</code> CSS selector, which is not available in Internet Explorer 8.'),
221
  );
222
  $form['general']['tables']['bootstrap_table_responsive'] = array(
223
    '#type' => 'checkbox',
224
    '#title' => t('Responsive tables'),
225
    '#default_value' => bootstrap_setting('table_responsive', $theme),
226
    '#description' => t('Makes tables responsive by wrapping them in <code>.table-responsive</code> to make them scroll horizontally up to small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables.'),
227
  );
228

    
229
  // Components.
230
  $form['components'] = array(
231
    '#type' => 'fieldset',
232
    '#title' => t('Components'),
233
    '#group' => 'bootstrap',
234
  );
235

    
236
  // Breadcrumbs.
237
  $form['components']['breadcrumbs'] = array(
238
    '#type' => 'fieldset',
239
    '#title' => t('Breadcrumbs'),
240
  );
241

    
242
  // Show message for Path Breadcrumbs module support.
243
  if (_bootstrap_use_path_breadcrumbs($theme)) {
244
    $form['components']['breadcrumbs']['#description'] = t('The <a href="!path_breadcrumbs" target="_blank">Path Breadcrumbs</a> module is being used to manage this site\'s breadcrumbs display and cannot be configured via theme settings. To configure this site\'s breadcrumbs display, enable the <a href="!enable">Path Breadcrumbs UI</a> sub-module and then visit <a href="!settings">Path Breadcrumbs Settings</a>.', array(
245
      '!path_breadcrumbs' => 'https://www.drupal.org/project/path_breadcrumbs',
246
      '!enable' => url('admin/modules', array('fragment' => 'edit-modules-path-breadcrumbs')),
247
      '!settings' => url('admin/structure/path-breadcrumbs/settings'),
248
    ));
249
  }
250
  else {
251
    $form['components']['breadcrumbs']['#collapsible'] = TRUE;
252
    $form['components']['breadcrumbs']['#collapsed'] = TRUE;
253
    $form['components']['breadcrumbs']['bootstrap_breadcrumb'] = array(
254
      '#type' => 'select',
255
      '#title' => t('Breadcrumb visibility'),
256
      '#default_value' => bootstrap_setting('breadcrumb', $theme),
257
      '#options' => array(
258
        0 => t('Hidden'),
259
        1 => t('Visible'),
260
        2 => t('Only in admin areas'),
261
      ),
262
    );
263
    $form['components']['breadcrumbs']['bootstrap_breadcrumb_home'] = array(
264
      '#type' => 'checkbox',
265
      '#title' => t('Show "Home" breadcrumb link'),
266
      '#default_value' => bootstrap_setting('breadcrumb_home', $theme),
267
      '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is enabled.'),
268
      '#states' => array(
269
        'invisible' => array(
270
          ':input[name="bootstrap_breadcrumb"]' => array('value' => 0),
271
        ),
272
      ),
273
    );
274
    $form['components']['breadcrumbs']['bootstrap_breadcrumb_title'] = array(
275
      '#type' => 'checkbox',
276
      '#title' => t('Show current page title at end'),
277
      '#default_value' => bootstrap_setting('breadcrumb_title', $theme),
278
      '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is disabled.'),
279
      '#states' => array(
280
        'invisible' => array(
281
          ':input[name="bootstrap_breadcrumb"]' => array('value' => 0),
282
        ),
283
      ),
284
    );
285
  }
286

    
287
  // Navbar.
288
  $form['components']['navbar'] = array(
289
    '#type' => 'fieldset',
290
    '#title' => t('Navbar'),
291
    '#collapsible' => TRUE,
292
    '#collapsed' => TRUE,
293
  );
294
  $form['components']['navbar']['bootstrap_navbar_position'] = array(
295
    '#type' => 'select',
296
    '#title' => t('Navbar Position'),
297
    '#description' => t('Select your Navbar position.'),
298
    '#default_value' => bootstrap_setting('navbar_position', $theme),
299
    '#options' => array(
300
      'static-top' => t('Static Top'),
301
      'fixed-top' => t('Fixed Top'),
302
      'fixed-bottom' => t('Fixed Bottom'),
303
    ),
304
    '#empty_option' => t('Normal'),
305
  );
306
  $form['components']['navbar']['bootstrap_navbar_inverse'] = array(
307
    '#type' => 'checkbox',
308
    '#title' => t('Inverse navbar style'),
309
    '#description' => t('Select if you want the inverse navbar style.'),
310
    '#default_value' => bootstrap_setting('navbar_inverse', $theme),
311
  );
312

    
313
  // Pager
314
  $form['components']['pager'] = array(
315
    '#type' => 'fieldset',
316
    '#title' => t('Pagination'),
317
    '#collapsible' => TRUE,
318
    '#collapsed' => TRUE,
319
  );
320

    
321
  $form['components']['pager']['bootstrap_pager_first_and_last'] = array(
322
    '#type' => 'checkbox',
323
    '#title' => t('Show "First" and "Last" links in the pager'),
324
    '#description' => t('Allow user to choose whether to display "First" and "Last" links on pagers.'),
325
    '#default_value' => bootstrap_setting('pager_first_and_last', $theme),
326
  );
327

    
328
  // Region wells.
329
  $wells = array(
330
    '' => t('None'),
331
    'well' => t('.well (normal)'),
332
    'well well-sm' => t('.well-sm (small)'),
333
    'well well-lg' => t('.well-lg (large)'),
334
  );
335
  $form['components']['region_wells'] = array(
336
    '#type' => 'fieldset',
337
    '#title' => t('Region wells'),
338
    '#description' => t('Enable the <code>.well</code>, <code>.well-sm</code> or <code>.well-lg</code> classes for specified regions. See: documentation on <a href="!wells" target="_blank">Bootstrap Wells</a>.', array(
339
      '!wells' => 'http://getbootstrap.com/components/#wells',
340
    )),
341
    '#collapsible' => TRUE,
342
    '#collapsed' => TRUE,
343
  );
344
  // Get defined regions.
345
  $regions = system_region_list($theme);
346
  foreach ($regions as $name => $title) {
347
    $form['components']['region_wells']['bootstrap_region_well-' . $name] = array(
348
      '#title' => $title,
349
      '#type' => 'select',
350
      '#attributes' => array(
351
        'class' => array('input-sm'),
352
      ),
353
      '#options' => $wells,
354
      '#default_value' => bootstrap_setting('region_well-' . $name, $theme),
355
    );
356
  }
357

    
358
  // JavaScript settings.
359
  $form['javascript'] = array(
360
    '#type' => 'fieldset',
361
    '#title' => t('JavaScript'),
362
    '#group' => 'bootstrap',
363
  );
364

    
365
  // Anchors.
366
  $form['javascript']['anchors'] = array(
367
    '#type' => 'fieldset',
368
    '#title' => t('Anchors'),
369
    '#collapsible' => TRUE,
370
    '#collapsed' => TRUE,
371
    '#description' => t('This plugin is not able to be configured from the UI as it is severely broken. In an effort to balance not break backwards compatibility and to prevent new users from running into unforeseen issues, you must manually opt-in/out inside your theme .info file. Please see the following issue for more details: <a href="!url" target="_blank">Replace custom JS with the bootstrap-anchor plugin</a>', array(
372
      '!url' => 'https://www.drupal.org/node/2462645',
373
    )),
374
  );
375
  $form['javascript']['anchors']['bootstrap_anchors_fix'] = array(
376
    '#type' => 'checkbox',
377
    '#title' => t('Fix anchor positions'),
378
    '#default_value' => bootstrap_setting('anchors_fix', $theme),
379
    '#description' => t('Ensures anchors are correctly positioned only when there is margin or padding detected on the BODY element. This is useful when fixed navbar or administration menus are used.'),
380
    // Prevent UI edits, see description above.
381
    '#disabled' => TRUE,
382
  );
383
  $form['javascript']['anchors']['bootstrap_anchors_smooth_scrolling'] = array(
384
    '#type' => 'checkbox',
385
    '#title' => t('Enable smooth scrolling'),
386
    '#default_value' => bootstrap_setting('anchors_smooth_scrolling', $theme),
387
    '#description' => t('Animates page by scrolling to an anchor link target smoothly when clicked.'),
388
    '#states' => array(
389
      'invisible' => array(
390
        ':input[name="bootstrap_anchors_fix"]' => array('checked' => FALSE),
391
      ),
392
    ),
393
    // Prevent UI edits, see description above.
394
    '#disabled' => TRUE,
395
  );
396

    
397
  // Forms.
398
  $form['javascript']['forms'] = array(
399
    '#type' => 'fieldset',
400
    '#title' => t('Forms'),
401
    '#collapsible' => TRUE,
402
    '#collapsed' => TRUE,
403
  );
404
  $form['javascript']['forms']['bootstrap_forms_has_error_value_toggle'] = array(
405
    '#type' => 'checkbox',
406
    '#title' => t('Automatically remove error classes when values have been entered'),
407
    '#default_value' => bootstrap_setting('forms_has_error_value_toggle', $theme),
408
    '#description' => t('If an element has a <code>.has-error</code> class attached to it, enabling this will automatically remove that class when a value is entered. This feature compliments the "General > Forms > Make required elements display as an error" feature.'),
409
  );
410

    
411
  // Popovers.
412
  $form['javascript']['popovers'] = array(
413
    '#type' => 'fieldset',
414
    '#title' => t('Popovers'),
415
    '#description' => t('Add small overlays of content, like those on the iPad, to any element for housing secondary information.'),
416
    '#collapsible' => TRUE,
417
    '#collapsed' => TRUE,
418
  );
419
  $form['javascript']['popovers']['bootstrap_popover_enabled'] = array(
420
    '#type' => 'checkbox',
421
    '#title' => t('Enable popovers.'),
422
    '#description' => t('Elements that have the <code>data-toggle="popover"</code> attribute set will automatically initialize the popover upon page load. <strong class="error text-error">WARNING: This feature can sometimes impact performance. Disable if pages appear to "hang" after initial load.</strong>'),
423
    '#default_value' => bootstrap_setting('popover_enabled', $theme),
424
  );
425
  $form['javascript']['popovers']['options'] = array(
426
    '#type' => 'fieldset',
427
    '#title' => t('Options'),
428
    '#description' => t('These are global options. Each popover can independently override desired settings by appending the option name to <code>data-</code>. Example: <code>data-animation="false"</code>.'),
429
    '#collapsible' => TRUE,
430
    '#collapsed' => TRUE,
431
    '#states' => array(
432
      'visible' => array(
433
        ':input[name="bootstrap_popover_enabled"]' => array('checked' => TRUE),
434
      ),
435
    ),
436
  );
437
  $form['javascript']['popovers']['options']['bootstrap_popover_animation'] = array(
438
    '#type' => 'checkbox',
439
    '#title' => t('animate'),
440
    '#description' => t('Apply a CSS fade transition to the popover.'),
441
    '#default_value' => bootstrap_setting('popover_animation', $theme),
442
  );
443
  $form['javascript']['popovers']['options']['bootstrap_popover_html'] = array(
444
    '#type' => 'checkbox',
445
    '#title' => t('HTML'),
446
    '#description' => t("Insert HTML into the popover. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks."),
447
    '#default_value' => bootstrap_setting('popover_html', $theme),
448
  );
449
  $form['javascript']['popovers']['options']['bootstrap_popover_placement'] = array(
450
    '#type' => 'select',
451
    '#title' => t('placement'),
452
    '#description' => t('Where to position the popover. When "auto" is specified, it will dynamically reorient the popover. For example, if placement is "auto left", the popover will display to the left when possible, otherwise it will display right.'),
453
    '#default_value' => bootstrap_setting('popover_placement', $theme),
454
    '#options' => drupal_map_assoc(array(
455
      'top',
456
      'bottom',
457
      'left',
458
      'right',
459
      'auto',
460
      'auto top',
461
      'auto bottom',
462
      'auto left',
463
      'auto right',
464
    )),
465
  );
466
  $form['javascript']['popovers']['options']['bootstrap_popover_selector'] = array(
467
    '#type' => 'textfield',
468
    '#title' => t('selector'),
469
    '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See <a href="!this" target="_blank">this</a> and <a href="!example" target="_blank">an informative example</a>.', array(
470
      '!this' => 'https://github.com/twbs/bootstrap/issues/4215',
471
      '!example' => 'http://jsfiddle.net/fScua/',
472
    )),
473
    '#default_value' => bootstrap_setting('popover_selector', $theme),
474
  );
475
  $form['javascript']['popovers']['options']['bootstrap_popover_trigger'] = array(
476
    '#type' => 'checkboxes',
477
    '#title' => t('trigger'),
478
    '#description' => t('How a popover is triggered.'),
479
    '#default_value' => bootstrap_setting('popover_trigger', $theme),
480
    '#options' => drupal_map_assoc(array(
481
      'click',
482
      'hover',
483
      'focus',
484
      'manual',
485
    )),
486
  );
487
  $form['javascript']['popovers']['options']['bootstrap_popover_trigger_autoclose'] = array(
488
    '#type' => 'checkbox',
489
    '#title' => t('Auto-close on document click'),
490
    '#description' => t('Will automatically close the current popover if a click occurs anywhere else other than the popover element.'),
491
    '#default_value' => bootstrap_setting('popover_trigger_autoclose', $theme),
492
  );
493
  $form['javascript']['popovers']['options']['bootstrap_popover_title'] = array(
494
    '#type' => 'textfield',
495
    '#title' => t('title'),
496
    '#description' => t("Default title value if \"title\" attribute isn't present."),
497
    '#default_value' => bootstrap_setting('popover_title', $theme),
498
  );
499
  $form['javascript']['popovers']['options']['bootstrap_popover_content'] = array(
500
    '#type' => 'textfield',
501
    '#title' => t('content'),
502
    '#description' => t('Default content value if "data-content" or "data-target" attributes are not present.'),
503
    '#default_value' => bootstrap_setting('popover_content', $theme),
504
  );
505
  $form['javascript']['popovers']['options']['bootstrap_popover_delay'] = array(
506
    '#type' => 'textfield',
507
    '#title' => t('delay'),
508
    '#description' => t('The amount of time to delay showing and hiding the popover (in milliseconds). Does not apply to manual trigger type.'),
509
    '#default_value' => bootstrap_setting('popover_delay', $theme),
510
  );
511
  $form['javascript']['popovers']['options']['bootstrap_popover_container'] = array(
512
    '#type' => 'textfield',
513
    '#title' => t('container'),
514
    '#description' => t('Appends the popover to a specific element. Example: "body". This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize.'),
515
    '#default_value' => bootstrap_setting('popover_container', $theme),
516
  );
517

    
518
  // Tooltips.
519
  $form['javascript']['tooltips'] = array(
520
    '#type' => 'fieldset',
521
    '#title' => t('Tooltips'),
522
    '#description' => t('Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don\'t rely on images, use CSS3 for animations, and data-attributes for local title storage. See <a href="!url" target="_blank">Bootstrap tooltips</a> for more documentation.', array(
523
      '!url' => 'http://getbootstrap.com/javascript/#tooltips',
524
    )),
525
    '#collapsible' => TRUE,
526
    '#collapsed' => TRUE,
527
  );
528
  $form['javascript']['tooltips']['bootstrap_tooltip_enabled'] = array(
529
    '#type' => 'checkbox',
530
    '#title' => t('Enable tooltips'),
531
    '#description' => t('Elements that have the <code>data-toggle="tooltip"</code> attribute set will automatically initialize the tooltip upon page load. <strong class="error text-error">WARNING: This feature can sometimes impact performance. Disable if pages appear to "hang" after initial load.</strong>'),
532
    '#default_value' => bootstrap_setting('tooltip_enabled', $theme),
533
  );
534
  $form['javascript']['tooltips']['options'] = array(
535
    '#type' => 'fieldset',
536
    '#title' => t('Options'),
537
    '#description' => t('These are global options. Each tooltip can independently override desired settings by appending the option name to <code>data-</code>. Example: <code>data-animation="false"</code>.'),
538
    '#collapsible' => TRUE,
539
    '#collapsed' => TRUE,
540
    '#states' => array(
541
      'visible' => array(
542
        ':input[name="bootstrap_tooltip_enabled"]' => array('checked' => TRUE),
543
      ),
544
    ),
545
  );
546
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_animation'] = array(
547
    '#type' => 'checkbox',
548
    '#title' => t('animate'),
549
    '#description' => t('Apply a CSS fade transition to the tooltip.'),
550
    '#default_value' => bootstrap_setting('tooltip_animation', $theme),
551
  );
552
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_html'] = array(
553
    '#type' => 'checkbox',
554
    '#title' => t('HTML'),
555
    '#description' => t("Insert HTML into the tooltip. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks."),
556
    '#default_value' => bootstrap_setting('tooltip_html', $theme),
557
  );
558
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_placement'] = array(
559
    '#type' => 'select',
560
    '#title' => t('placement'),
561
    '#description' => t('Where to position the tooltip. When "auto" is specified, it will dynamically reorient the tooltip. For example, if placement is "auto left", the tooltip will display to the left when possible, otherwise it will display right.'),
562
    '#default_value' => bootstrap_setting('tooltip_placement', $theme),
563
    '#options' => drupal_map_assoc(array(
564
      'top',
565
      'bottom',
566
      'left',
567
      'right',
568
      'auto',
569
      'auto top',
570
      'auto bottom',
571
      'auto left',
572
      'auto right',
573
    )),
574
  );
575
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_selector'] = array(
576
    '#type' => 'textfield',
577
    '#title' => t('selector'),
578
    '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets.'),
579
    '#default_value' => bootstrap_setting('tooltip_selector', $theme),
580
  );
581
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_trigger'] = array(
582
    '#type' => 'checkboxes',
583
    '#title' => t('trigger'),
584
    '#description' => t('How a tooltip is triggered.'),
585
    '#default_value' => bootstrap_setting('tooltip_trigger', $theme),
586
    '#options' => drupal_map_assoc(array(
587
      'click',
588
      'hover',
589
      'focus',
590
      'manual',
591
    )),
592
  );
593
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_delay'] = array(
594
    '#type' => 'textfield',
595
    '#title' => t('delay'),
596
    '#description' => t('The amount of time to delay showing and hiding the tooltip (in milliseconds). Does not apply to manual trigger type.'),
597
    '#default_value' => bootstrap_setting('tooltip_delay', $theme),
598
  );
599
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_container'] = array(
600
    '#type' => 'textfield',
601
    '#title' => t('container'),
602
    '#description' => t('Appends the tooltip to a specific element. Example: "body"'),
603
    '#default_value' => bootstrap_setting('tooltip_container', $theme),
604
  );
605

    
606
  // Advanced settings.
607
  $form['advanced'] = array(
608
    '#type' => 'fieldset',
609
    '#title' => t('Advanced'),
610
    '#group' => 'bootstrap',
611
  );
612

    
613
  // jQuery Update error suppression.
614
  $form['advanced']['bootstrap_toggle_jquery_error'] = array(
615
    '#type' => 'checkbox',
616
    '#title' => t('Suppress jQuery version error message'),
617
    '#default_value' => bootstrap_setting('toggle_jquery_error', $theme),
618
    '#description' => t('Enable this if the version of jQuery has been upgraded to 1.9+ using a method other than the <a href="!jquery_update" target="_blank">jQuery Update</a> module.', array(
619
      '!jquery_update' => 'https://drupal.org/project/jquery_update',
620
    )),
621
  );
622

    
623
  // BootstrapCDN.
624
  bootstrap_cdn_provider_settings_form($form, $form_state, $theme);
625
}