You are here

function theme_scanner_results in Search and Replace Scanner 7

Same name and namespace in other branches
  1. 5.2 scanner.module \theme_scanner_results()
  2. 6 scanner.module \theme_scanner_results()

Theme the search results.

1 theme call to theme_scanner_results()
scanner_execute in ./scanner.module
Handles the actual search and replace.

File

./scanner.theme.inc, line 11
Theme callbacks for the scanner module.

Code

function theme_scanner_results($variables) {
  $results = $variables['results'];
  $output = NULL;
  if (is_array($results)) {
    $total = count($results);
    drupal_set_message(filter_xss('Found matches in ' . $total . ' fields. <a href="#results">See below</a> for details.', $allowed_tags = array(
      'a',
    )));
    $output = '<p>Found matches in ' . $total . ' fields:</p>';
    $output .= '<ol class="scanner-results scanner-search-results">';
    foreach ($results as $item) {
      $output .= theme('scanner_item', array(
        'item' => $item,
      ));
    }
    $output .= '</ol>';

    // @todo use pager to split up results.
  }
  else {
    drupal_set_message(t('No matches found. Check the !url for fields that can be searched.', array(
      '!url' => l(t('settings'), 'admin/config/content/scanner'),
    )), 'warning');
  }
  return $output;
}