I want to use a page function for the default value in a text field.
There is Is it possible to show the current date in query language? doing something similar. However, I can’t get it to work.
This is the blueprint of the field:
tournee:
label: Tournee
default: "{{page.year}}"
type: text
In the folder models I put a file with the same name as the blueprint file.
Its contents:
class Medienspiegelarchiv extends Page
{
public function year()
{
return date('Y');
}
}
When I open the page in the panel the textfield contains the string {{page.year}} instead of 2023.
What am I missing?
Thanks a lot for any feedback!