You are here

function theme_filefield_sources_list in FileField Sources 6

Same name and namespace in other branches
  1. 7 filefield_sources.module \theme_filefield_sources_list()

Theme the display of the sources list.

1 theme call to theme_filefield_sources_list()
filefield_sources_field_process in ./filefield_sources.module
A #process callback to extend the filefield_widget element type.

File

./filefield_sources.module, line 366
Extend FileField to allow files from multiple sources.

Code

function theme_filefield_sources_list($element, $sources) {
  $links = array();

  // Add the default "Upload" since it's not in our list.
  $default['upload'] = array(
    'label' => t('Upload'),
    'description' => t('Upload a file from your computer.'),
  );
  $sources = array_merge($default, $sources);
  foreach ($sources as $name => $source) {
    $links[] = '<a href="#" onclick="return false;" title="' . $source['description'] . '" id="' . $element['#id'] . '-' . $name . '-source" class="filefield-source filefield-source-' . $name . '">' . $source['label'] . '</a>';
  }
  return '<div class="filefield-sources-list">' . implode(' | ', $links) . '</div>';
}