protected function DomStrReplace::doReplace in Migrate Plus 8.5
Same name and namespace in other branches
- 8.4 src/Plugin/migrate/process/DomStrReplace.php \Drupal\migrate_plus\Plugin\migrate\process\DomStrReplace::doReplace()
Retrieves the right replace string based on configuration.
Parameters
\DOMElement $html_node: The current element from iteration.
string $search: The search string or pattern.
string $replace: The replacement string.
string $subject: The string on which to perform the substitution.
1 call to DomStrReplace::doReplace()
- DomStrReplace::transform in src/
Plugin/ migrate/ process/ DomStrReplace.php - Performs the associated process.
1 method overrides DomStrReplace::doReplace()
- DomMigrationLookup::doReplace in src/
Plugin/ migrate/ process/ DomMigrationLookup.php - Retrieves the right replace string based on configuration.
File
- src/
Plugin/ migrate/ process/ DomStrReplace.php, line 248
Class
- DomStrReplace
- String replacements on a source dom.
Namespace
Drupal\migrate_plus\Plugin\migrate\processCode
protected function doReplace(\DOMElement $html_node, $search, $replace, $subject) {
if ($this->configuration['regex']) {
$function = 'preg_replace';
}
elseif ($this->configuration['case_insensitive']) {
$function = 'str_ireplace';
}
else {
$function = 'str_replace';
}
$new_subject = $function($search, $replace, $subject);
$this
->postReplace($html_node, $new_subject);
}