function text_scanner_preg_replace in Search and Replace Scanner 7
Implements hook_scanner_preg_replace().
File
- ./
scanner.module, line 1446 - Search and Replace Scanner - works on all nodes text content.
Code
function text_scanner_preg_replace(&$node, $field, $matches, $row, $regexstr, $replace) {
// Performed on behalf of text.module.
if (!empty($row->summary) && !empty($matches)) {
$old_value = $node->{$matches[1]}[$language][$row->delta]['summary'];
$new_value = preg_replace($regexstr, $replace, $old_value, -1, $hits);
$node->{$matches[1]}[$language][$row->delta]['summary'] = $new_value;
return $hits;
}
return 0;
}