blob: 42203cb59387c0b9bef1fb09fc5a53121531088a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
<?php
//$Id$
/**
*
* @file
* Theme functions for the videoftp module.
*/
/**
* FormAPI theme function. Theme the output of an video ftp field.
*/
function theme_videoftp_widget($element) {
return theme('form_element', $element, $element['#children']);
}
function theme_videoftp_widget_item($element) {
// Put the upload button directly after the upload field.
$element['ftpselect']['#field_suffix'] = drupal_render($element['videoftp_attach']);
$element['ftpselect']['#theme'] = 'videoftp_widget_file';
$output = '<div class="filefield-element clear-block">';
if ($element['fid']['#value'] != 0) {
$output .= '<div class="widget-preview">';
$output .= drupal_render($element['preview']);
$output .= '</div>';
}
$output .= '<div class="widget-edit">';
$output .= drupal_render($element);
$output .= '</div>';
$output .= '</div>';
return $output;
}
/**
* Custom theme function for VideoFTP upload elements.
*
* This function allows us to put the "Attach" button immediately after the
* select field by respecting the #field_suffix property.
*/
function theme_videoftp_widget_file($element) {
$output .= '<div class="filefield-upload clear-block">';
if (isset($element['#field_prefix'])) {
$output .= $element['#field_prefix'];
}
$size = $element['#size'] ? ' size="'. $element['#size'] .'"' : '';
_form_set_class($element, array('form-select'));
$multiple = $element['#multiple'];
$output .= '<select name="'. $element['#name'] .''. ($multiple ? '[]' : '') .'"'. ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="'. $element['#id'] .'" '. $size .'>'. form_select_options($element) ."</select>\n";
if (isset($element['#field_suffix'])) {
$output .= $element['#field_suffix'];
}
$output .= '</div>';
return theme('form_element', $element, $output);
}
|