Projet

Général

Profil

Paste
Télécharger (2,02 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / bootstrap / templates / system / html.vars.php @ b220caf9

1
<?php
2
/**
3
 * @file
4
 * Stub file for "html" theme hook [pre]process functions.
5
 */
6

    
7
/**
8
 * Pre-processes variables for the "html" theme hook.
9
 *
10
 * See template for list of available variables.
11
 *
12
 * @see html.tpl.php
13
 *
14
 * @ingroup theme_preprocess
15
 */
16
function bootstrap_preprocess_html(&$variables) {
17
  // Backport from Drupal 8 RDFa/HTML5 implementation.
18
  // @see https://www.drupal.org/node/1077566
19
  // @see https://www.drupal.org/node/1164926
20

    
21
  // HTML element attributes.
22
  $variables['html_attributes_array'] = array(
23
    'lang' => $variables['language']->language,
24
    'dir' => $variables['language']->dir,
25
  );
26

    
27
  // Override existing RDF namespaces to use RDFa 1.1 namespace prefix bindings.
28
  if (function_exists('rdf_get_namespaces')) {
29
    $rdf = array('prefix' => array());
30
    foreach (rdf_get_namespaces() as $prefix => $uri) {
31
      $rdf['prefix'][] = $prefix . ': ' . $uri;
32
    }
33
    if (!$rdf['prefix']) {
34
      $rdf = array();
35
    }
36
    $variables['rdf_namespaces'] = drupal_attributes($rdf);
37
  }
38

    
39
  // BODY element attributes.
40
  $variables['body_attributes_array'] = array(
41
    'role'  => 'document',
42
    'class' => &$variables['classes_array'],
43
  );
44
  $variables['body_attributes_array'] += $variables['attributes_array'];
45

    
46
  // Navbar position.
47
  switch (bootstrap_setting('navbar_position')) {
48
    case 'fixed-top':
49
      $variables['body_attributes_array']['class'][] = 'navbar-is-fixed-top';
50
      break;
51

    
52
    case 'fixed-bottom':
53
      $variables['body_attributes_array']['class'][] = 'navbar-is-fixed-bottom';
54
      break;
55

    
56
    case 'static-top':
57
      $variables['body_attributes_array']['class'][] = 'navbar-is-static-top';
58
      break;
59
  }
60
}
61

    
62
/**
63
 * Processes variables for the "html" theme hook.
64
 *
65
 * See template for list of available variables.
66
 *
67
 * @see html.tpl.php
68
 *
69
 * @ingroup theme_process
70
 */
71
function bootstrap_process_html(&$variables) {
72
  $variables['html_attributes'] = drupal_attributes($variables['html_attributes_array']);
73
  $variables['body_attributes'] = drupal_attributes($variables['body_attributes_array']);
74
}