root / drupal7 / sites / all / themes / bootstrap / templates / image / image-widget.func.php @ 388c412d
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 ($element['fid']['#value'] != 0) { |
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 |
else {
|
37 |
$element['upload']['#prefix'] = '<div class="input-group">'; |
38 |
$element['upload']['#suffix'] = '</div>'; |
39 |
$element['upload_button']['#prefix'] = '<span class="input-group-btn">'; |
40 |
$element['upload_button']['#suffix'] = '</span>'; |
41 |
} |
42 |
|
43 |
$output .= drupal_render_children($element); |
44 |
$output .= '</div>'; |
45 |
$output .= '</div>'; |
46 |
|
47 |
return $output; |
48 |
} |