silverstripe-autocomplete icon indicating copy to clipboard operation
silverstripe-autocomplete copied to clipboard

Autocomplete in the Frontend with Subsites

Open hudhaifas opened this issue 8 years ago • 1 comments

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();
}

hudhaifas avatar Dec 26 '16 19:12 hudhaifas

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.

wilr avatar Mar 29 '17 04:03 wilr