New Suggestion class (name is singular) provides the following options:
Required: Query string that you want suggestions for
Optional: Limit the number of suggestions that are returned
Optional: Field that should be used for generating suggestions
Noting that not all services support "fields" for their suggestions, but this feels like a reasonable feature that could be silenctly ignored if plugins are created for those services.
Result
New Suggestions class (name is plural) which contains an array of string suggestions that were returned from your desired service.
forTemplate() and getIterator() provided so that you can loop through this object, which will give you one suggestion per iteration.
A couple of helper properties were added:
$desiredQueryStringField
$desiredLinkUrl
I've added a description of these fields to the class docblock, but TL;DR: they are there for developers to populate (if they want) so that when this object attempt to render, it knows where to link the query suggestion off to (EG: your search page).
Query
New
Suggestion
class (name is singular) provides the following options:Noting that not all services support "fields" for their suggestions, but this feels like a reasonable feature that could be silenctly ignored if plugins are created for those services.
Result
New
Suggestions
class (name is plural) which contains an array of string suggestions that were returned from your desired service.forTemplate()
andgetIterator()
provided so that you can loop through this object, which will give you one suggestion per iteration.A couple of helper properties were added:
$desiredQueryStringField
$desiredLinkUrl
I've added a description of these fields to the class docblock, but TL;DR: they are there for developers to populate (if they want) so that when this object attempt to render, it knows where to link the query suggestion off to (EG: your search page).