You are here

function theme_media_link in D7 Media 7

Stolen from file.module theme_file_link

Parameters

$variables: An associative array containing:

  • file: A file object to which the link will be created.
1 theme call to theme_media_link()
media_admin_list in includes/media.admin.inc
Form builder: Builds the media list administration overview.

File

includes/media.theme.inc, line 246
Media Theming

Code

function theme_media_link($variables) {
  $file = $variables['file'];
  $url = 'media/' . $file->fid;
  $icon = theme('file_icon', array(
    'file' => $file,
  ));

  // Set options as per anchor format described at
  // http://microformats.org/wiki/file-format-examples
  $options = array(
    'attributes' => array(
      'type' => $file->filemime . '; length=' . $file->filesize,
    ),
  );

  // Use the description as the link text if available.
  if (empty($file->description)) {
    $link_text = check_plain($file->filename);
  }
  else {
    $link_text = check_plain($file->description);
    $options['attributes']['title'] = check_plain($file->filename);
  }
  return '<span class="file">' . $icon . ' ' . l($link_text, $url, $options) . '</span>';
}