Projet

Général

Profil

Révision caf16a48

Ajouté par Assos Assos il y a presque 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/themes/bootstrap/theme-settings.php
5 5
 *
6 6
 * Provides theme settings for Bootstrap based themes when admin theme is not.
7 7
 *
8
 * @see theme/settings.inc
8
 * @see ./includes/settings.inc
9 9
 */
10 10

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

  
16 17
/**
17 18
 * Implements hook_form_FORM_ID_alter().
18 19
 */
19 20
function bootstrap_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL) {
20
  // Work-around for a core bug affecting admin themes.
21
  // Do not add Bootstrap specific settings to non-bootstrap based themes,
22
  // including a work-around for a core bug affecting admin themes.
21 23
  // @see https://drupal.org/node/943212
22
  if (isset($form_id)) {
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))) {
23 26
    return;
24 27
  }
25
  // Include theme settings file.
26
  bootstrap_include('bootstrap', 'theme/settings.inc');
27
  // Alter theme settings form.
28
  _bootstrap_settings_form($form, $form_state);
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
      drupal_set_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' => 'https://www.drupal.org/project/jquery_update',
43
        '!jquery_update_configure' => url('admin/config/development/jquery_update'),
44
        '!bootstrap_suppress_jquery_error' => url('admin/appearance/settings/' . $theme, array(
45
          'fragment' => 'edit-bootstrap-toggle-jquery-error',
46
        )),
47
      )), 'error', FALSE);
48
    }
49
  }
50

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

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

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

  
82
  // Buttons.
83
  $form['general']['buttons'] = array(
84
    '#type' => 'fieldset',
85
    '#title' => t('Buttons'),
86
    '#collapsible' => TRUE,
87
    '#collapsed' => TRUE,
88
  );
89
  $form['general']['buttons']['bootstrap_button_size'] = array(
90
    '#type' => 'select',
91
    '#title' => t('Default button size'),
92
    '#default_value' => bootstrap_setting('button_size', $theme),
93
    '#empty_option' => t('Normal'),
94
    '#options' => array(
95
      'btn-xs' => t('Extra Small'),
96
      'btn-sm' => t('Small'),
97
      'btn-lg' => t('Large'),
98
    ),
99
  );
100
  $form['general']['buttons']['bootstrap_button_colorize'] = array(
101
    '#type' => 'checkbox',
102
    '#title' => t('Colorize Buttons'),
103
    '#default_value' => bootstrap_setting('button_colorize', $theme),
104
    '#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(
105
      '!bootstrap_url' => 'http://getbootstrap.com/css/#buttons',
106
      '!api_url' => 'http://drupal-bootstrap.org/apis/hook_bootstrap_colorize_text_alter',
107
    )),
108
  );
109
  $form['general']['buttons']['bootstrap_button_iconize'] = array(
110
    '#type' => 'checkbox',
111
    '#title' => t('Iconize Buttons'),
112
    '#default_value' => bootstrap_setting('button_iconize', $theme),
113
    '#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(
114
      '!api_url' => 'http://drupal-bootstrap.org/apis/hook_bootstrap_iconize_text_alter',
115
    )),
116
  );
117

  
118
  // Forms.
119
  $form['general']['forms'] = array(
120
    '#type' => 'fieldset',
121
    '#title' => t('Forms'),
122
    '#collapsible' => TRUE,
123
    '#collapsed' => TRUE,
124
  );
125
  $form['general']['forms']['bootstrap_forms_required_has_error'] = array(
126
    '#type' => 'checkbox',
127
    '#title' => t('Make required elements display as an error'),
128
    '#default_value' => bootstrap_setting('forms_required_has_error', $theme),
129
    '#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.'),
130
  );
131
  $form['general']['forms']['bootstrap_forms_smart_descriptions'] = array(
132
    '#type' => 'checkbox',
133
    '#title' => t('Smart form descriptions (via Tooltips)'),
134
    '#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.'),
135
    '#default_value' => bootstrap_setting('forms_smart_descriptions', $theme),
136
  );
137
  $form['general']['forms']['bootstrap_forms_smart_descriptions_limit'] = array(
138
    '#type' => 'textfield',
139
    '#title' => t('"Smart form descriptions" maximum character limit'),
140
    '#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.'),
141
    '#default_value' => bootstrap_setting('forms_smart_descriptions_limit', $theme),
142
    '#states' => array(
143
      'visible' => array(
144
        ':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE),
145
      ),
146
    ),
147
  );
148
  $form['general']['forms']['bootstrap_forms_smart_descriptions_allowed_tags'] = array(
149
    '#type' => 'textfield',
150
    '#title' => t('"Smart form descriptions" allowed (HTML) tags'),
151
    '#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.'),
152
    '#default_value' => bootstrap_setting('forms_smart_descriptions_allowed_tags', $theme),
153
    '#states' => array(
154
      'visible' => array(
155
        ':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE),
156
      ),
157
    ),
158
  );
159

  
160
  // Images.
161
  $form['general']['images'] = array(
162
    '#type' => 'fieldset',
163
    '#title' => t('Images'),
164
    '#collapsible' => TRUE,
165
    '#collapsed' => TRUE,
166
  );
167
  $form['general']['images']['bootstrap_image_shape'] = array(
168
    '#type' => 'select',
169
    '#title' => t('Default image shape'),
170
    '#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(
171
      '!bootstrap_url' => 'http://getbootstrap.com/css/#images-shapes',
172
    )),
173
    '#default_value' => bootstrap_setting('image_shape', $theme),
174
    '#empty_option' => t('None'),
175
    '#options' => array(
176
      'img-rounded' => t('Rounded'),
177
      'img-circle' => t('Circle'),
178
      'img-thumbnail' => t('Thumbnail'),
179
    ),
180
  );
181
  $form['general']['images']['bootstrap_image_responsive'] = array(
182
    '#type' => 'checkbox',
183
    '#title' => t('Responsive Images'),
184
    '#default_value' => bootstrap_setting('image_responsive', $theme),
185
    '#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.'),
186
  );
187

  
188
  // Tables.
189
  $form['general']['tables'] = array(
190
    '#type' => 'fieldset',
191
    '#title' => t('Tables'),
192
    '#collapsible' => TRUE,
193
    '#collapsed' => TRUE,
194
  );
195
  $form['general']['tables']['bootstrap_table_bordered'] = array(
196
    '#type' => 'checkbox',
197
    '#title' => t('Bordered table'),
198
    '#default_value' => bootstrap_setting('table_bordered', $theme),
199
    '#description' => t('Add borders on all sides of the table and cells.'),
200
  );
201
  $form['general']['tables']['bootstrap_table_condensed'] = array(
202
    '#type' => 'checkbox',
203
    '#title' => t('Condensed table'),
204
    '#default_value' => bootstrap_setting('table_condensed', $theme),
205
    '#description' => t('Make tables more compact by cutting cell padding in half.'),
206
  );
207
  $form['general']['tables']['bootstrap_table_hover'] = array(
208
    '#type' => 'checkbox',
209
    '#title' => t('Hover rows'),
210
    '#default_value' => bootstrap_setting('table_hover', $theme),
211
    '#description' => t('Enable a hover state on table rows.'),
212
  );
213
  $form['general']['tables']['bootstrap_table_striped'] = array(
214
    '#type' => 'checkbox',
215
    '#title' => t('Striped rows'),
216
    '#default_value' => bootstrap_setting('table_striped', $theme),
217
    '#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.'),
218
  );
219
  $form['general']['tables']['bootstrap_table_responsive'] = array(
220
    '#type' => 'checkbox',
221
    '#title' => t('Responsive tables'),
222
    '#default_value' => bootstrap_setting('table_responsive', $theme),
223
    '#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.'),
224
  );
225

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

  
233
  // Breadcrumbs.
234
  $form['components']['breadcrumbs'] = array(
235
    '#type' => 'fieldset',
236
    '#title' => t('Breadcrumbs'),
237
    '#collapsible' => TRUE,
238
    '#collapsed' => TRUE,
239
  );
240
  $form['components']['breadcrumbs']['bootstrap_breadcrumb'] = array(
241
    '#type' => 'select',
242
    '#title' => t('Breadcrumb visibility'),
243
    '#default_value' => bootstrap_setting('breadcrumb', $theme),
244
    '#options' => array(
245
      0 => t('Hidden'),
246
      1 => t('Visible'),
247
      2 => t('Only in admin areas'),
248
    ),
249
  );
250
  $form['components']['breadcrumbs']['bootstrap_breadcrumb_home'] = array(
251
    '#type' => 'checkbox',
252
    '#title' => t('Show "Home" breadcrumb link'),
253
    '#default_value' => bootstrap_setting('breadcrumb_home', $theme),
254
    '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is enabled.'),
255
    '#states' => array(
256
      'invisible' => array(
257
        ':input[name="bootstrap_breadcrumb"]' => array('value' => 0),
258
      ),
259
    ),
260
  );
261
  $form['components']['breadcrumbs']['bootstrap_breadcrumb_title'] = array(
262
    '#type' => 'checkbox',
263
    '#title' => t('Show current page title at end'),
264
    '#default_value' => bootstrap_setting('breadcrumb_title', $theme),
265
    '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is disabled.'),
266
    '#states' => array(
267
      'invisible' => array(
268
        ':input[name="bootstrap_breadcrumb"]' => array('value' => 0),
269
      ),
270
    ),
271
  );
272

  
273
  // Navbar.
274
  $form['components']['navbar'] = array(
275
    '#type' => 'fieldset',
276
    '#title' => t('Navbar'),
277
    '#collapsible' => TRUE,
278
    '#collapsed' => TRUE,
279
  );
280
  $form['components']['navbar']['bootstrap_navbar_position'] = array(
281
    '#type' => 'select',
282
    '#title' => t('Navbar Position'),
283
    '#description' => t('Select your Navbar position.'),
284
    '#default_value' => bootstrap_setting('navbar_position', $theme),
285
    '#options' => array(
286
      'static-top' => t('Static Top'),
287
      'fixed-top' => t('Fixed Top'),
288
      'fixed-bottom' => t('Fixed Bottom'),
289
    ),
290
    '#empty_option' => t('Normal'),
291
  );
292
  $form['components']['navbar']['bootstrap_navbar_inverse'] = array(
293
    '#type' => 'checkbox',
294
    '#title' => t('Inverse navbar style'),
295
    '#description' => t('Select if you want the inverse navbar style.'),
296
    '#default_value' => bootstrap_setting('navbar_inverse', $theme),
297
  );
298

  
299
  // Pager
300
  $form['components']['pager'] = array(
301
    '#type' => 'fieldset',
302
    '#title' => t('Pagination'),
303
    '#collapsible' => TRUE,
304
    '#collapsed' => TRUE,
305
  );
306

  
307
  $form['components']['pager']['bootstrap_pager_first_and_last'] = array(
308
    '#type' => 'checkbox',
309
    '#title' => t('Show "First" and "Last" links in the pager'),
310
    '#description' => t('Allow user to choose whether to display "First" and "Last" links on pagers.'),
311
    '#default_value' => bootstrap_setting('pager_first_and_last', $theme),
312
  );
313

  
314
  // Region wells.
315
  $wells = array(
316
    '' => t('None'),
317
    'well' => t('.well (normal)'),
318
    'well well-sm' => t('.well-sm (small)'),
319
    'well well-lg' => t('.well-lg (large)'),
320
  );
321
  $form['components']['region_wells'] = array(
322
    '#type' => 'fieldset',
323
    '#title' => t('Region wells'),
324
    '#description' => t('Enable the <code>.well</code>, <code>.well-sm</code> or <code>.well-lg</code> classes for specified regions. See: documentation on !wells.', array(
325
      '!wells' => l(t('Bootstrap Wells'), 'http://getbootstrap.com/components/#wells'),
326
    )),
327
    '#collapsible' => TRUE,
328
    '#collapsed' => TRUE,
329
  );
330
  // Get defined regions.
331
  $regions = system_region_list($theme);
332
  foreach ($regions as $name => $title) {
333
    $form['components']['region_wells']['bootstrap_region_well-' . $name] = array(
334
      '#title' => $title,
335
      '#type' => 'select',
336
      '#attributes' => array(
337
        'class' => array('input-sm'),
338
      ),
339
      '#options' => $wells,
340
      '#default_value' => bootstrap_setting('region_well-' . $name, $theme),
341
    );
342
  }
343

  
344
  // JavaScript settings.
345
  $form['javascript'] = array(
346
    '#type' => 'fieldset',
347
    '#title' => t('JavaScript'),
348
    '#group' => 'bootstrap',
349
  );
350

  
351
  // Anchors.
352
  $form['javascript']['anchors'] = array(
353
    '#type' => 'fieldset',
354
    '#title' => t('Anchors'),
355
    '#collapsible' => TRUE,
356
    '#collapsed' => TRUE,
357
    '#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(
358
      '!url' => 'https://www.drupal.org/node/2462645',
359
    )),
360
  );
361
  $form['javascript']['anchors']['bootstrap_anchors_fix'] = array(
362
    '#type' => 'checkbox',
363
    '#title' => t('Fix anchor positions'),
364
    '#default_value' => bootstrap_setting('anchors_fix', $theme),
365
    '#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.'),
366
    // Prevent UI edits, see description above.
367
    '#disabled' => TRUE,
368
  );
369
  $form['javascript']['anchors']['bootstrap_anchors_smooth_scrolling'] = array(
370
    '#type' => 'checkbox',
371
    '#title' => t('Enable smooth scrolling'),
372
    '#default_value' => bootstrap_setting('anchors_smooth_scrolling', $theme),
373
    '#description' => t('Animates page by scrolling to an anchor link target smoothly when clicked.'),
374
    '#states' => array(
375
      'invisible' => array(
376
        ':input[name="bootstrap_anchors_fix"]' => array('checked' => FALSE),
377
      ),
378
    ),
379
    // Prevent UI edits, see description above.
380
    '#disabled' => TRUE,
381
  );
382

  
383
  // Forms.
384
  $form['javascript']['forms'] = array(
385
    '#type' => 'fieldset',
386
    '#title' => t('Forms'),
387
    '#collapsible' => TRUE,
388
    '#collapsed' => TRUE,
389
  );
390
  $form['javascript']['forms']['bootstrap_forms_has_error_value_toggle'] = array(
391
    '#type' => 'checkbox',
392
    '#title' => t('Automatically remove error classes when values have been entered'),
393
    '#default_value' => bootstrap_setting('forms_has_error_value_toggle', $theme),
394
    '#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.'),
395
  );
396

  
397
  // Popovers.
398
  $form['javascript']['popovers'] = array(
399
    '#type' => 'fieldset',
400
    '#title' => t('Popovers'),
401
    '#description' => t('Add small overlays of content, like those on the iPad, to any element for housing secondary information.'),
402
    '#collapsible' => TRUE,
403
    '#collapsed' => TRUE,
404
  );
405
  $form['javascript']['popovers']['bootstrap_popover_enabled'] = array(
406
    '#type' => 'checkbox',
407
    '#title' => t('Enable popovers.'),
408
    '#description' => t('Elements that have the !code attribute set will automatically initialize the popover upon page load. !warning', array(
409
      '!code' => '<code>data-toggle="popover"</code>',
410
      '!warning' => '<strong class="error text-error">WARNING: This feature can sometimes impact performance. Disable if pages appear to "hang" after initial load.</strong>',
411
    )),
412
    '#default_value' => bootstrap_setting('popover_enabled', $theme),
413
  );
414
  $form['javascript']['popovers']['options'] = array(
415
    '#type' => 'fieldset',
416
    '#title' => t('Options'),
417
    '#description' => t('These are global options. Each popover can independently override desired settings by appending the option name to !data. Example: !data-animation.', array(
418
      '!data' => '<code>data-</code>',
419
      '!data-animation' => '<code>data-animation="false"</code>',
420
    )),
421
    '#collapsible' => TRUE,
422
    '#collapsed' => TRUE,
423
    '#states' => array(
424
      'visible' => array(
425
        ':input[name="bootstrap_popover_enabled"]' => array('checked' => TRUE),
426
      ),
427
    ),
428
  );
429
  $form['javascript']['popovers']['options']['bootstrap_popover_animation'] = array(
430
    '#type' => 'checkbox',
431
    '#title' => t('animate'),
432
    '#description' => t('Apply a CSS fade transition to the popover.'),
433
    '#default_value' => bootstrap_setting('popover_animation', $theme),
434
  );
435
  $form['javascript']['popovers']['options']['bootstrap_popover_html'] = array(
436
    '#type' => 'checkbox',
437
    '#title' => t('HTML'),
438
    '#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."),
439
    '#default_value' => bootstrap_setting('popover_html', $theme),
440
  );
441
  $form['javascript']['popovers']['options']['bootstrap_popover_placement'] = array(
442
    '#type' => 'select',
443
    '#title' => t('placement'),
444
    '#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.'),
445
    '#default_value' => bootstrap_setting('popover_placement', $theme),
446
    '#options' => drupal_map_assoc(array(
447
      'top',
448
      'bottom',
449
      'left',
450
      'right',
451
      'auto',
452
      'auto top',
453
      'auto bottom',
454
      'auto left',
455
      'auto right',
456
    )),
457
  );
458
  $form['javascript']['popovers']['options']['bootstrap_popover_selector'] = array(
459
    '#type' => 'textfield',
460
    '#title' => t('selector'),
461
    '#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 !this and !example.', array(
462
      '!this' => l(t('this'), 'https://github.com/twbs/bootstrap/issues/4215'),
463
      '!example' => l(t('an informative example'), 'http://jsfiddle.net/fScua/'),
464
    )),
465
    '#default_value' => bootstrap_setting('popover_selector', $theme),
466
  );
467
  $form['javascript']['popovers']['options']['bootstrap_popover_trigger'] = array(
468
    '#type' => 'checkboxes',
469
    '#title' => t('trigger'),
470
    '#description' => t('How a popover is triggered.'),
471
    '#default_value' => bootstrap_setting('popover_trigger', $theme),
472
    '#options' => drupal_map_assoc(array(
473
      'click',
474
      'hover',
475
      'focus',
476
      'manual',
477
    )),
478
  );
479
  $form['javascript']['popovers']['options']['bootstrap_popover_trigger_autoclose'] = array(
480
    '#type' => 'checkbox',
481
    '#title' => t('Auto-close on document click'),
482
    '#description' => t('Will automatically close the current popover if a click occurs anywhere else other than the popover element.'),
483
    '#default_value' => bootstrap_setting('popover_trigger_autoclose', $theme),
484
  );
485
  $form['javascript']['popovers']['options']['bootstrap_popover_title'] = array(
486
    '#type' => 'textfield',
487
    '#title' => t('title'),
488
    '#description' => t("Default title value if \"title\" attribute isn't present."),
489
    '#default_value' => bootstrap_setting('popover_title', $theme),
490
  );
491
  $form['javascript']['popovers']['options']['bootstrap_popover_content'] = array(
492
    '#type' => 'textfield',
493
    '#title' => t('content'),
494
    '#description' => t('Default content value if "data-content" or "data-target" attributes are not present.'),
495
    '#default_value' => bootstrap_setting('popover_content', $theme),
496
  );
497
  $form['javascript']['popovers']['options']['bootstrap_popover_delay'] = array(
498
    '#type' => 'textfield',
499
    '#title' => t('delay'),
500
    '#description' => t('The amount of time to delay showing and hiding the popover (in milliseconds). Does not apply to manual trigger type.'),
501
    '#default_value' => bootstrap_setting('popover_delay', $theme),
502
  );
503
  $form['javascript']['popovers']['options']['bootstrap_popover_container'] = array(
504
    '#type' => 'textfield',
505
    '#title' => t('container'),
506
    '#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.'),
507
    '#default_value' => bootstrap_setting('popover_container', $theme),
508
  );
509

  
510
  // Tooltips.
511
  $form['javascript']['tooltips'] = array(
512
    '#type' => 'fieldset',
513
    '#title' => t('Tooltips'),
514
    '#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 !link for more documentation.", array(
515
      '!link' => l(t('Bootstrap tooltips'), 'http://getbootstrap.com/javascript/#tooltips'),
516
    )),
517
    '#collapsible' => TRUE,
518
    '#collapsed' => TRUE,
519
  );
520
  $form['javascript']['tooltips']['bootstrap_tooltip_enabled'] = array(
521
    '#type' => 'checkbox',
522
    '#title' => t('Enable tooltips'),
523
    '#description' => t('Elements that have the !code attribute set will automatically initialize the tooltip upon page load. !warning', array(
524
      '!code' => '<code>data-toggle="tooltip"</code>',
525
      '!warning' => '<strong class="error text-error">WARNING: This feature can sometimes impact performance. Disable if pages appear to "hang" after initial load.</strong>',
526
    )),
527
    '#default_value' => bootstrap_setting('tooltip_enabled', $theme),
528
  );
529
  $form['javascript']['tooltips']['options'] = array(
530
    '#type' => 'fieldset',
531
    '#title' => t('Options'),
532
    '#description' => t('These are global options. Each tooltip can independently override desired settings by appending the option name to !data. Example: !data-animation.', array(
533
      '!data' => '<code>data-</code>',
534
      '!data-animation' => '<code>data-animation="false"</code>',
535
    )),
536
    '#collapsible' => TRUE,
537
    '#collapsed' => TRUE,
538
    '#states' => array(
539
      'visible' => array(
540
        ':input[name="bootstrap_tooltip_enabled"]' => array('checked' => TRUE),
541
      ),
542
    ),
543
  );
544
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_animation'] = array(
545
    '#type' => 'checkbox',
546
    '#title' => t('animate'),
547
    '#description' => t('Apply a CSS fade transition to the tooltip.'),
548
    '#default_value' => bootstrap_setting('tooltip_animation', $theme),
549
  );
550
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_html'] = array(
551
    '#type' => 'checkbox',
552
    '#title' => t('HTML'),
553
    '#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."),
554
    '#default_value' => bootstrap_setting('tooltip_html', $theme),
555
  );
556
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_placement'] = array(
557
    '#type' => 'select',
558
    '#title' => t('placement'),
559
    '#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.'),
560
    '#default_value' => bootstrap_setting('tooltip_placement', $theme),
561
    '#options' => drupal_map_assoc(array(
562
      'top',
563
      'bottom',
564
      'left',
565
      'right',
566
      'auto',
567
      'auto top',
568
      'auto bottom',
569
      'auto left',
570
      'auto right',
571
    )),
572
  );
573
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_selector'] = array(
574
    '#type' => 'textfield',
575
    '#title' => t('selector'),
576
    '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets.'),
577
    '#default_value' => bootstrap_setting('tooltip_selector', $theme),
578
  );
579
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_trigger'] = array(
580
    '#type' => 'checkboxes',
581
    '#title' => t('trigger'),
582
    '#description' => t('How a tooltip is triggered.'),
583
    '#default_value' => bootstrap_setting('tooltip_trigger', $theme),
584
    '#options' => drupal_map_assoc(array(
585
      'click',
586
      'hover',
587
      'focus',
588
      'manual',
589
    )),
590
  );
591
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_delay'] = array(
592
    '#type' => 'textfield',
593
    '#title' => t('delay'),
594
    '#description' => t('The amount of time to delay showing and hiding the tooltip (in milliseconds). Does not apply to manual trigger type.'),
595
    '#default_value' => bootstrap_setting('tooltip_delay', $theme),
596
  );
597
  $form['javascript']['tooltips']['options']['bootstrap_tooltip_container'] = array(
598
    '#type' => 'textfield',
599
    '#title' => t('container'),
600
    '#description' => t('Appends the tooltip to a specific element. Example: "body"'),
601
    '#default_value' => bootstrap_setting('tooltip_container', $theme),
602
  );
603

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

  
611
  // jQuery Update error suppression.
612
  $form['advanced']['bootstrap_toggle_jquery_error'] = array(
613
    '#type' => 'checkbox',
614
    '#title' => t('Suppress jQuery version error message'),
615
    '#default_value' => bootstrap_setting('toggle_jquery_error', $theme),
616
    '#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(
617
      '!jquery_update' => 'https://drupal.org/project/jquery_update',
618
    )),
619
  );
620

  
621
  // BootstrapCDN.
622
  bootstrap_cdn_provider_settings_form($form, $form_state, $theme);
29 623
}

Formats disponibles : Unified diff