I have a form with a checkboxSetField list which works as expected.
For each checkbox item in the loop I want to call a method, I know this is out of scope so I have created an extension.
CheckboxSetField::add_extension('OperatorFormExtension');
OperatorFormExtension.php
class OperatorFormExtension extends DataExtension {
public function testing($ID) {
return 'hello - '.$ID;
}
}
checkboxSetField.ss
<% loop $Options %>
<input id="$ID" class="checkbox" name="$Name" type="checkbox" value="$Value.ATT"<% if $isChecked %> checked="checked"<% end_if %><% if $isDisabled %> disabled="disabled"<% end_if %> />
<label for="$ID">$Title, testing('myParam')</label><br>
<% end_loop %>
When I call the method as above I don't get anything displayed on the page.
If I extend the Form class instead of CheckboxSetField I can call the testing method from the form but still not from the checkboxSetField template.
How do I call a method from the CheckboxSetField.ss template?