function _entity_translation_taxonomy_autocomplete_widget_get_terms in Entity Translation 7
Returns the terms referenced by the taxonomy autocomplete widget field.
Parameters
array $element: The taxonomy autocomplete form element.
Return value
object[] An associative array of taxonomy term object keyed by their identifiers.
2 calls to _entity_translation_taxonomy_autocomplete_widget_get_terms()
- entity_translation_field_widget_taxonomy_autocomplete_form_alter in ./
entity_translation.taxonomy.inc - Implements hook_field_widget_WIDGET_TYPE_form_alter().
- entity_translation_taxonomy_autocomplete_validate in ./
entity_translation.taxonomy.inc - Form element validate handler for taxonomy term autocomplete element.
File
- ./
entity_translation.taxonomy.inc, line 261 - The taxonomy specific translation functions and hook implementations.
Code
function _entity_translation_taxonomy_autocomplete_widget_get_terms($element) {
$items = isset($element['#entity']->{$element['#field_name']}[$element['#language']]) ? $element['#entity']->{$element['#field_name']}[$element['#language']] : array();
$tids = array_map(function ($item) {
return $item['tid'];
}, $items);
return taxonomy_term_load_multiple($tids);
}