public static function FeedImportFilter::removeTags in Feed Import 8
Same name in this branch
- 8 feed_import_base/filters/feed_import_default_filters.php \FeedImportFilter::removeTags()
- 8 feed_import_base/src/Filter/FeedImportFilter.php \Drupal\feed_import_base\FeedImportFilter::removeTags()
Remove tags
Parameters
mixed $field: A string or an array of strings
string $tags: A string containing tags to remove separated by space or array of tags
Return value
mixed Result without tags
File
- feed_import_base/
src/ Filter/ FeedImportFilter.php, line 618
Class
- FeedImportFilter
- This class contains default filters for feed import.
Namespace
Drupal\feed_import_baseCode
public static function removeTags($field, $tags) {
if (!is_array($tags)) {
$tags = explode(' ', trim($tags));
}
if (is_array($field)) {
foreach ($field as &$f) {
$f = self::removeTags($f, $tags);
}
return $field;
}
foreach ($tags as &$tag) {
$field = preg_replace('@<' . $tag . '( |>).*?</' . $tag . '>@si', '', $field);
}
return $field;
}