public function AutoCompleteController::handleAutocomplete in Pardot Integration 2.x
1 string reference to 'AutoCompleteController::handleAutocomplete'
File
- src/
Controller/ AutoCompleteController.php, line 40
Class
- AutoCompleteController
- Class AutoCompleteController.
Namespace
Drupal\pardot\ControllerCode
public function handleAutocomplete(Request $request, $entity_id) {
$input = $request->query
->get('q');
// // Right now we only need to worry about utilizing contact_message.
$entity = \Drupal::entityTypeManager()
->getStorage('contact_message')
->create([
'contact_form' => $entity_id,
]);
$entity_definition = $entity
->getTypedData()
->getDataDefinition();
$fetched_data = $this->typedDataDataFetcher
->autocompletePropertyPath([
'contact_message' => $entity_definition,
], $input);
return new JsonResponse($fetched_data);
}