I’m working on a field and in the input
method I tried this which I thought would do the same thing:
echo $this->page()->prev()->slug();
echo page($this->page()->id())->prev()->slug();
In the first case I try to get the slug by the field object. Instead I got this:
Fatal error: Method PrevnextField::__toString() must not throw an exception, caught Error: Call to a member function slug() on null in C:\xampp\htdocs\lanera.se\kirby\vendor\getkirby\toolkit\lib\brick.php on line 0
In the second one everything works like expected. The difference is that I wrap everything into the page method.
My question, is this intended, or a bug?