Error: Trying to get property of non-object w/ kirbytext helper

I am using Kirby Footnotes in a text field.

I am also adding an extra bit of text at the end of that field in a programmatic manner, by using the kirbytext() helper:

(kirbytext($page->text() . '🝏')

When combining the footnotes plugin and this extra function to the text field, distantnative suggested me to use the following syntax:

<?php echo KirbyFootnotes::field(kirbytext($page->text() . '🝏'), ['bibliography' => false]) ?>

I got this error:

Trying to get property of non-object

Is it because of the kirbytext helper? I know I could simply resolve this by using this syntax

$page->text()->kirbytext . '🝏'

but I need 🝏 to be within the kirbytext div.

Any suggestion would be highly appreciated! Thanks!

This seems to work:

  $field = new Field($page, null, trim(kirbytext($page->text() . '🝏')));
  echo KirbyFootnotes::field($field, ['bibliography' => false]);

Yes it works! Wonderful.

Could you tell me what the first line of code does, exactly? Are you making a variable?

The first line creates a new object of type Field, which is then stored in the variable $field.

The static method KirbyFootnotes::field($field, $args) expects a first parameter of type Field, while kirbytext($page->text() . '🝏') returns a string.

OK got it!

It works perfectly but when there are inlined images in the text field the added mark (. '🝏') is not printed.

Are media treated differently?

Hm, works for me?

Really strange. I also tried to make a new post and add as last element an image, with

(image: screen-shot-2017-01-22-at-20.36.39.png)

and when I check the page it does not have even the trace of the closing mark.

Gonna do some more testing later, thank you a lot!