$Foo("param"), $Foo('param'), and $Foo(param) will all pass 'param' as a string. It is recommended that you always use quotes when passing a string for clarity
So type$ID is passed as that literal string.
I got something working but I’m hoping there’s a better way…
Currently:
Form template call is: $Up.Fields.dataFieldByName($Up.ThePage.getSomeValue($ID))
Form creation in controller:
$form->setFormMethod('GET')
# bunch of settings here
->customise([
# bunch of stuff here
'ThePage' => $this
]);
In the controller:
public function getSomeValue($id)
{
return 'type['.$id.']';
}
There is currently no way to pass variables into functions from a template. I’m honestly surprised that example works, but it’s great that it does!
Generally though, for something like this, you’d want to handle the logic in your controller, and just use the result in your template.
I have edited your post slightly to remove an offensive word - please try to avoid language that might offend others.
There is currently no way to pass variables into functions from a template. I’m honestly surprised that example works
Seems there is then? If variable subs work is it worth looking at interpolation?
Generally though, for something like this, you’d want to handle the logic in your controller, and just use the result in your template.
Please explain further.
The logic of field creation is in a controller. The template is just pushing out dynamic fields in a loop. I have a set of type fields I need to split across different parents that are in accordions.