root / drupal7 / sites / all / themes / bootstrap / templates / image / image-widget.func.php @ 05237dd8
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* @file
|
4 |
* Stub file for bootstrap_image_widget().
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* Returns HTML for an image field widget.
|
9 |
*
|
10 |
* @param $variables
|
11 |
* An associative array containing:
|
12 |
* - element: A render element representing the image field widget.
|
13 |
*
|
14 |
* @return string
|
15 |
* The constructed HTML.
|
16 |
*
|
17 |
* @see theme_image_widget()
|
18 |
*
|
19 |
* @ingroup theme_functions
|
20 |
*/
|
21 |
function bootstrap_image_widget($variables) { |
22 |
$element = $variables['element']; |
23 |
$output = ''; |
24 |
$output .= '<div class="image-widget form-managed-file clearfix">'; |
25 |
|
26 |
if (isset($element['preview'])) { |
27 |
$output .= '<div class="image-preview">'; |
28 |
$output .= drupal_render($element['preview']); |
29 |
$output .= '</div>'; |
30 |
} |
31 |
|
32 |
$output .= '<div class="image-widget-data">'; |
33 |
if (!empty($element['fid']['#value'])) { |
34 |
$element['filename']['#markup'] = '<div class="form-group">' . $element['filename']['#markup'] . ' <span class="file-size badge">' . format_size($element['#file']->filesize) . '</span></div>'; |
35 |
} |
36 |
|
37 |
$output .= drupal_render_children($element); |
38 |
$output .= '</div>'; |
39 |
$output .= '</div>'; |
40 |
|
41 |
return $output; |
42 |
} |