Using Latte's stripHtml filter within a presenter?

TerryTibbs
Member | 5
+
0
-

Hi all,

Is there any easy way to use Latte's stripHtml filter from within a presenter? I have looked through Nette\Utils\Strings to see if there was something similar in there but it appears not.

I am using the full framework.

Thanks in advance

TerryTibbs
Member | 5
+
0
-

Ah thanks. So I can just call the following within the presenter?

$stripped = Latte\Runtime\Filters::convertHtmlToText($title);

Rick Strafy
Nette Blogger | 78
+
+1
-

You'll just call what those methods are calling html_entity_decode(strip_tags($s), ENT_QUOTES | ENT_HTML5, 'UTF-8')

Because both classes are marked as internal, so there is no guarantee that method names/parameters or classes will not change.

mskocik
Member | 60
+
+4
-

There is also Nette\Utils\Html::htmlToText(string $html) method which does the same thing.

TerryTibbs
Member | 5
+
0
-

Thanks a lot for the answers everyone.