root / drupal7 / sites / all / themes / bootstrap / templates / bootstrap / bootstrap-modal.vars.php @ 7547bb19
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* @file
|
4 |
* Stub file for "bootstrap_modal" theme hook [pre]process functions.
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* Pre-processes variables for the "bootstrap_modal" theme hook.
|
9 |
*
|
10 |
* See template for list of available variables.
|
11 |
*
|
12 |
* @see bootstrap-modal.tpl.php
|
13 |
*
|
14 |
* @ingroup theme_preprocess
|
15 |
*
|
16 |
* @todo: Replace with "bootstrap_effect_fade" theme setting.
|
17 |
*/
|
18 |
function bootstrap_preprocess_bootstrap_modal(&$variables) { |
19 |
if (empty($variables['attributes']['id'])) { |
20 |
$variables['attributes']['id'] = drupal_html_id(strip_tags($variables['heading'])); |
21 |
} |
22 |
$variables['attributes']['class'][] = 'modal'; |
23 |
$variables['attributes']['class'][] = 'fade'; |
24 |
$variables['attributes']['tabindex'] = -1; |
25 |
$variables['attributes']['role'] = 'dialog'; |
26 |
$variables['attributes']['aria-hidden'] = 'true'; |
27 |
$variables['dialog_attributes']['class'][] = 'modal-dialog'; |
28 |
|
29 |
if (!empty($variables['size'])) { |
30 |
$variables['dialog_attributes']['class'][] = drupal_html_class('modal-' . $variables['size']); |
31 |
} |
32 |
} |
33 |
|
34 |
/**
|
35 |
* Processes variables for the "bootstrap_modal" theme hook.
|
36 |
*
|
37 |
* See template for list of available variables.
|
38 |
*
|
39 |
* @see bootstrap-modal.tpl.php
|
40 |
*
|
41 |
* @ingroup theme_process
|
42 |
*/
|
43 |
function bootstrap_process_bootstrap_modal(&$variables) { |
44 |
$variables['attributes'] = drupal_attributes($variables['attributes']); |
45 |
$variables['dialog_attributes'] = drupal_attributes($variables['dialog_attributes']); |
46 |
|
47 |
$html = !empty($variables['html_heading']); |
48 |
$heading = $html && is_scalar($variables['heading']) ? filter_xss_admin($variables['heading']) : render($variables['heading']); |
49 |
$variables['heading'] = $html ? $heading : check_plain($heading); |
50 |
|
51 |
$variables['body'] = render($variables['body']); |
52 |
$variables['footer'] = render($variables['footer']); |
53 |
} |