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:
<?php
$field = new Field($page, null, trim(kirbytext($page->text() . 'π')));
echo KirbyFootnotes::field($field, ['bibliography' => false]);
?>
texnixe:
<?php
$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?
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!