Closed (works as designed)
Project:
Entity Autocomplete
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Jan 2019 at 15:03 UTC
Updated:
7 Jan 2019 at 14:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
purushotam.rai commentedComment #3
purushotam.rai commentedComment #5
purushotam.rai commentedupdated entity_autocomplete_element_label function as well.
Comment #6
b-prod commented@purushotam.rai
This module does not depend on Entity API (@see http://cgit.drupalcode.org/entity_autocomplete/tree/entity_autocomplete....).
So we can not rely on the
entity_metadata_wrapper()function, which may not exist if the Entity API module is not installed.Moreover, you should factorise your code inside a new function, instead of duplicating twice the same code.
Finally, there is no need to load the entity if you intend to use the
entity_metadata_wrapper(), as this function will also accept an entity ID as data:$wrapper = entity_metadata_wrapper($entity_type, $entity_id);You can then check for the entity existence using the
value()method that will return either the entity instance or NULL.To be able to handle properly the label translation, you have to keep in mind that Drupal 7 provides 2 types of entity translations: Entity translation and i18n translations. Both does not work the same way and require very different SQL queries.
This really needs to be handle using a single query and not extra processes that will have a bad result on performances...