You are here

protected function RestfulEntityBase::getQueryResultForAutocomplete in RESTful 7

Returns the result of a query for the auto complete.

Return value

array Array keyed by the entity ID and the unsanitized entity label as value.

1 call to RestfulEntityBase::getQueryResultForAutocomplete()
RestfulEntityBase::getListForAutocomplete in plugins/restful/RestfulEntityBase.php
Return the values of the types tags, with the ID.

File

plugins/restful/RestfulEntityBase.php, line 257
Contains RestfulEntityBase.

Class

RestfulEntityBase
An abstract implementation of RestfulEntityInterface.

Code

protected function getQueryResultForAutocomplete() {
  $entity_type = $this
    ->getEntityType();
  $query = $this
    ->getQueryForAutocomplete();
  $result = $query
    ->execute();
  if (empty($result[$entity_type])) {

    // No entities found.
    return array();
  }
  $ids = array_keys($result[$entity_type]);
  $return = array();
  foreach (entity_load($entity_type, $ids) as $id => $entity) {
    $return[$id] = entity_label($entity_type, $entity);
  }
  return $return;
}