You are here

function search_files_search_item_format in Search Files 6.2

Same name and namespace in other branches
  1. 5 search_files.module \search_files_search_item_format()

format the result items before that are displayed

Parameters

(array) $item:

(string) $type:

Return value

(string) $output formatted string

File

./search_files.module, line 479
Used to index files in attachments and directories

Code

function search_files_search_item_format($item, $type) {

  //drupal_set_message('entry = <pre>'.var_export($item, true).'</pre>');
  $output = ' <dt class="title"><a href="' . check_url($item['link']) . '">' . check_plain($item['title']) . '</a></dt>';
  $info = array();
  if ($item['type']) {
    $info[] = check_plain($item['type']);
  }
  if ($item['user']) {

    // Add this here so the user name appears at the end of the output
    $item['extra'][] = $item['user'];
  }
  if ($item['date']) {
    $info[] = format_date($item['date'], 'small');
  }
  if (is_array($item['extra'])) {
    $info = array_merge($info, $item['extra']);
  }
  $output .= ' <dd>' . ($item['snippet'] ? '<p>' . $item['snippet'] . '</p>' : '') . '<p class="search-info">' . implode(' - ', $info) . '</p></dd>';
  return $output;
}