Can I use a Kirby Helper within a field?

Hello all.

The folowing SVG Helper works fine when used within a template:

<?= svg("assets/images/arrow-right.svg") ?>

I would also like to use this same helper within a panel field.
However no matter how I configure field methods the helper is basically being replicated within the code like this:

I would obviously like the SVG to render and display inline.

My page blueprint setup is:

servicesoptions:
        label: Services Modules
        type: structure
        columns:
          title:
            width: 1/4
          text:
            width: 3/4
        fields:
          title:
            label: Title
            type: text
          icon:
            label: Icon
            type: files
          text:
            label: Text
            type: textarea
          url:
            label: Url
            type: text
            required: false
          linktext:
            label: Link Text
            type: text
            required: false

My template code is as follows:

 <?php if ($item->url()->isNotEmpty()): ?>
        			<a href="<?= $item->url()->html() ?>" class="btn"><?= $item->linktext()->kirbytextinline() ?></a>
         <?php endif; ?>

I would be grateful if someone could point me in the right direction.

Thank you.

Not quite getting where you are using this. Does this mean you try to put PHP code into a text field? This will not work.

What you could do intead is use a placeholder in your text that is then replaced with the code at runtime.

You’re getting it right @texnixe … I was attempting to use PHP within a text field. Thanks for clarifying this.

Having given the matter more thought I could just paste the SVG code directly into the text field. This works perfectly. However, the placeholder solution you suggest seems much more elegant. I’ll go with this.

Solved!

Thanks again for your assistance. Appreciated. :slight_smile: