Projet

Général

Profil

Paste
Télécharger (1,99 ko) Statistiques
| Branche: | Révision:

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

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
    'class' => &$variables['classes_array'],
42
  );
43
  $variables['body_attributes_array'] += $variables['attributes_array'];
44

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

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

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

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