Kirbytext filter only for specific template

Is it possible to create a kirbytext filter to apply only for a specific template?

I want to add an ending mark at the end of a

$page->text()->kirbytext()

but want to have the mark be within the closing tag that kirbytext produces.

Otherwise, how can I insert a character between

$page->text()

and the final

->kirbytext()
?

As of now I tried to use css to add a character via content, but with suboptimal results.

I tried something like

<?php
  $main_text = $page->text();
  $main_text__mark = $main_text . '*';

  echo $main_text__mark->kirbytext();
?>

but it says
Call to a member function kirbytext() on string

(which makes sense).

I thought that using a kirbytext pre-filter, though overkill, would be perfect, and it works—but I don’t want to add this to all instance of ->kirbytext() throughout the website, only to a particular template.

Thanks!

I think the easiest way would be to use the kirbytext() helper_

  <?php echo kirbytext($page->text() . '*'); ?>
1 Like

That’s great!

Thank you.