You are here

function i18n_taxonomy_entity_info_alter in Internationalization 7

Implements hook_entity_info_alter().

File

i18n_taxonomy/i18n_taxonomy.module, line 1258
i18n taxonomy module

Code

function i18n_taxonomy_entity_info_alter(&$entity_info) {
  if (isset($entity_info['taxonomy_vocabulary'])) {

    // Add altered vocabulary schema fields.
    $entity_info['taxonomy_vocabulary']['schema_fields_sql']['base table'][] = 'i18n_mode';
    $entity_info['taxonomy_vocabulary']['schema_fields_sql']['base table'][] = 'language';
  }
  if (isset($entity_info['taxonomy_term'])) {

    // Core doesn't provide a label callback for taxonomy terms. By setting one
    // we can use it to return the correct localized term name.
    $entity_info['taxonomy_term']['label callback'] = 'i18n_taxonomy_taxonomy_term_label';

    // Also let core know terms have languages, now.
    $entity_info['taxonomy_term']['entity keys']['language'] = 'language';
  }
}