function LinkitPluginTaxonomy_Term::autocomplete_callback in Linkit 7.2
The autocomplete callback function for the Linkit Taxonomy term plugin.
Overrides LinkitPluginEntity::autocomplete_callback
File
- plugins/
linkit_plugins/ linkit-plugin-taxonomy_term.class.php, line 53 - Define Linkit term plugin class.
Class
- LinkitPluginTaxonomy_Term
- @file Define Linkit term plugin class.
Code
function autocomplete_callback() {
// The term entity dont use the entity keys bundle definition, its using the
// vid instead, so lets 'translate' the bundle names to vids.
if (isset($this->entity_key_bundle) && isset($this->conf['bundles'])) {
$bundles = array_filter($this->conf['bundles']);
// Get all vocabularies.
$vocabularies = taxonomy_vocabulary_get_names();
// Temp storage for values.
$tmp_bundles = array();
foreach ($bundles as $bundle) {
$tmp_bundles[] = $vocabularies[$bundle]->{$this->entity_key_bundle};
}
// Assign the new values as the bundles.
$this->conf['bundles'] = $tmp_bundles;
}
// Call the parent.
return parent::autocomplete_callback();
}