Passing variables into templates with the API
I'm not sure if I'm missing something or doing something wrong but I need to access the ID of an item from within a template with my custom app.
What I'm doing is displaying a fixed field
echo $Form->text_field('projectName', 'Project Name', isset($details['projectName'])?$details['projectName']:false, false, false);
Then displaying the template fields
echo $Form->fields_from_template($Template, $details, $Projects->static_fields);
Within that template i have a repeater:
<perch:repeater id="layout" label="Layout" divider-before="Layout" scope-parent="true"> <perch:projects id="device" label="Device" type="devices" project="<perch:projects id="parent.projectID" />" /> </perch:repeater>
The device is a custom field type i have built that looks up devices relating to the current project, but I can't work out how to pass the current project id into the field.