public function Suggestion::toRenderable in Search API Autocomplete 8
Returns a render array representation of the object.
Return value
mixed[] A render array.
Overrides RenderableInterface::toRenderable
File
- src/
Suggestion/ Suggestion.php, line 253
Class
- Suggestion
- Provides a value object meant to be used as result of suggestions.
Namespace
Drupal\search_api_autocomplete\SuggestionCode
public function toRenderable() {
if (!empty($this->render)) {
return $this->render;
}
return [
'#theme' => 'search_api_autocomplete_suggestion',
'#keys' => $this
->getSuggestedKeys(),
'#url' => $this
->getUrl(),
'#note' => $this
->getPrefix(),
'#label' => $this
->getLabel(),
'#results_count' => $this
->getResultsCount(),
'#suggestion_prefix' => $this
->getSuggestionPrefix(),
'#suggestion_suffix' => $this
->getSuggestionSuffix(),
'#user_input' => $this
->getUserInput(),
];
}