You are here

function theme_filefield_source_attach_element in FileField Sources 6

Same name and namespace in other branches
  1. 7 sources/attach.inc \theme_filefield_source_attach_element()

Theme the output of the autocomplete field.

1 theme call to theme_filefield_source_attach_element()
filefield_source_attach_process in sources/attach.inc
A #process callback to extend the filefield_widget element type.

File

sources/attach.inc, line 249
A FileField extension to allow use of files within a server directory.

Code

function theme_filefield_source_attach_element($element) {
  if (isset($element['attach_message'])) {
    $output = $element['attach_message']['#value'];
  }
  else {
    $select = '';
    $size = !empty($element['filename']['#size']) ? ' size="' . $element['filename']['#size'] . '"' : '';
    _form_set_class($element['filename'], array(
      'form-select',
    ));
    $multiple = !empty($element['#multiple']);
    $output = '<select name="' . $element['filename']['#name'] . '' . ($multiple ? '[]' : '') . '"' . ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['filename']['#attributes']) . ' id="' . $element['filename']['#id'] . '" ' . $size . '>' . form_select_options($element['filename']) . '</select>';
  }
  $output .= theme('submit', $element['attach']);
  $element['#type'] = 'item';
  return '<div class="filefield-source filefield-source-attach clear-block">' . theme('form_element', $element, $output) . '</div>';
}