silverstripe-autocomplete
silverstripe-autocomplete copied to clipboard
Autocomplete in the Frontend with Subsites
When use AutoCompleteFiield on the fronend with Subsite module; the autocomplete field in the frontend fails to call the Suggest
function without the SubsiteID
parameter included in the SuggestURL
public function getSuggestURL() {
if (!empty($this->suggestURL)) {
return $this->suggestURL;
}
// Attempt to link back to itself
return parse_url($this->Link(), PHP_URL_PATH) . '/Suggest?SubsiteID=' . Subsite::currentSubsiteID();
}
IMHO, so many modules use variables etc translatable, subsites, versioned etc etc probably out of scope for the module to handle all the variables. Perhaps use $field->setSuggestURL()
to handle your specific instance.