See below for details.', $allowed_tags = array('a')));
$output = '
Found matches in ' . $total . ' fields:
';
$output .= '';
foreach ($results as $item) {
$output .= theme('scanner_item', array('item' => $item));
}
$output .= '
';
// @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;
}
/**
* Theme each search result hit.
*/
function theme_scanner_item($variables) {
$output = '';
$item = $variables['item'];
$item['count'] = $item['count'] > 0 ? $item['count'] : 'One or more';
$output .= '';
$output .= '' . l($item['title'], 'node/' . $item['nid']) . '
';
$output .= '[' . $item['count'] . ' matches in ' . $item['type'] . ' ' . $item['field_label'] . ' field:]
';
$output .= '' . $item['text'] . '';
$output .= '';
return $output;
}
/**
* Theme the replace results.
*/
function theme_scanner_replace_results($variables) {
$results = $variables['results'];
$output = '';
if (is_array($results)) {
drupal_set_message(filter_xss('Replaced items in ' . count($results) . ' fields. See below for details.', $allowed_tags = array('a')));
$output = 'Replaced items in ' . count($results) . ' fields:
';
$output .= '';
foreach ($results as $item) {
$output .= theme('scanner_replace_item', array('item' => $item));
}
$output .= '
';
// @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;
}
/**
* Theme each replace result hit.
*/
function theme_scanner_replace_item($variables) {
$output = '';
$item = $variables['item'];
$item['count'] = $item['count'] > 0 ? $item['count'] : 'One or more';
$output .= '';
$output .= '' . l($item['title'], 'node/' . $item['nid']) . '
';
$output .= '[' . $item['count'] . ' replacements in ' . $item['type'] . ' ' . $item['field_label'] . ' field]';
$output .= '';
return $output;
}