You are here

function search_files_search_item_format in Search Files 5

Same name and namespace in other branches
  1. 6.2 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

1 call to search_files_search_item_format()
search_files_search_page in ./search_files.module
generate the results page

File

./search_files.module, line 1003
Used to index all files in directory(s) on the server

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;
}