protected function DiffLayoutBase::applyMarkdown in Diff 8
Applies a markdown function to a string.
Parameters
string $markdown: Key of the markdown function to be applied to the items. One of drupal_html_to_text, filter_xss, filter_xss_all.
string $items: String to be processed.
Return value
array|string Result after markdown was applied on $items.
2 calls to DiffLayoutBase::applyMarkdown()
- SplitFieldsDiffLayout::build in src/
Plugin/ diff/ Layout/ SplitFieldsDiffLayout.php - Builds a diff comparison between two revisions.
- UnifiedFieldsDiffLayout::build in src/
Plugin/ diff/ Layout/ UnifiedFieldsDiffLayout.php - Builds a diff comparison between two revisions.
File
- src/
DiffLayoutBase.php, line 273
Class
- DiffLayoutBase
- Base class for diff layout plugins.
Namespace
Drupal\diffCode
protected function applyMarkdown($markdown, $items) {
if (!$markdown) {
return $items;
}
if ($markdown == 'drupal_html_to_text') {
return trim(MailFormatHelper::htmlToText($items), "\n");
}
elseif ($markdown == 'filter_xss') {
return trim(Xss::filter($items), "\n");
}
elseif ($markdown == 'filter_xss_all') {
return trim(Xss::filter($items, []), "\n");
}
else {
return $items;
}
}