Projet

Général

Profil

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

root / drupal7 / sites / all / themes / bootstrap / templates / image / image-widget.func.php @ eefc2ac0

1
<?php
2

    
3
/**
4
 * @file
5
 * Stub file for bootstrap_image_widget().
6
 */
7

    
8
/**
9
 * Returns HTML for an image field widget.
10
 *
11
 * @param array $variables
12
 *   An associative array containing:
13
 *   - element: A render element representing the image field widget.
14
 *
15
 * @return string
16
 *   The constructed HTML.
17
 *
18
 * @see theme_image_widget()
19
 *
20
 * @ingroup theme_functions
21
 */
22
function bootstrap_image_widget(array $variables) {
23
  $element = $variables['element'];
24
  $output = '';
25
  $output .= '<div class="image-widget form-managed-file clearfix">';
26

    
27
  if (isset($element['preview'])) {
28
    $output .= '<div class="image-preview">';
29
    $output .= drupal_render($element['preview']);
30
    $output .= '</div>';
31
  }
32

    
33
  $output .= '<div class="image-widget-data">';
34
  if (!empty($element['fid']['#value'])) {
35
    $element['filename']['#markup'] = '<div class="form-group">' . $element['filename']['#markup'] . ' <span class="file-size badge">' . format_size($element['#file']->filesize) . '</span></div>';
36
  }
37

    
38
  $output .= drupal_render_children($element);
39
  $output .= '</div>';
40
  $output .= '</div>';
41

    
42
  return $output;
43
}