You are here

public function SpamspanExtension::spamSpanFilter in SpamSpan filter 8.2

Same name and namespace in other branches
  1. 8 src/TwigExtension/SpamspanExtension.php \Drupal\spamspan\TwigExtension\SpamspanExtension::spamSpanFilter()

Applying spamspan filter to the given string.

Parameters

string $string: Text, maybe containing email addresses.

Return value

string The input text with emails replaced by spans

File

src/TwigExtension/SpamspanExtension.php, line 55

Class

SpamspanExtension
Provides the SpamSpan filter function within Twig templates.

Namespace

Drupal\spamspan\TwigExtension

Code

public function spamSpanFilter($string) {
  $template_attached = [
    '#attached' => [
      'library' => [
        'spamspan/obfuscate',
      ],
    ],
  ];
  $this->renderer
    ->render($template_attached);
  return Xss::filterAdmin(spamspan($string));
}