You are here

function tft_l in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 tft.module \tft_l()

Format a folder or file link.

Parameters

string $title: The link title

int $id: Either the taxonomy term tid or the node nid

string $mime: The mime type of the file (for a folder, use 'folder')

Return value

string HTML string with the formatted link

1 call to tft_l()
tft_get_content in ./tft.module
Get the folder content and return it in an array form for the theme_table call

File

./tft.module, line 973
Module hooks.

Code

function tft_l($title, $id, $mime) {
  if ($mime == 'folder') {
    return '<a href="#term/' . $id . '" class="folder-folder-link" id="tid-' . $id . '">' . $title . '</a>';
  }
  else {

    // Get the filefield icon
    $file = (object) array(
      'filemime' => $mime,
    );
    $icon = file_icon_path($file);
    return l($title, "tft/download/file/{$id}", array(
      'attributes' => array(
        'class' => 'file',
        'style' => "background-image: url(/{$icon})",
        'target' => '_blank',
      ),
    ));
  }
}