You are here

function pathauto_i18n_taxonomy_taxonomy_term_load in Pathauto i18n 8

Same name and namespace in other branches
  1. 7 modules/pathauto_i18n_taxonomy/pathauto_i18n_taxonomy.module \pathauto_i18n_taxonomy_taxonomy_term_load()

Implements hook_taxonomy_term_load().

File

modules/pathauto_i18n_taxonomy/pathauto_i18n_taxonomy.module, line 78
Provides tools for creating multilanguage aliases for taxonomy terms.

Code

function pathauto_i18n_taxonomy_taxonomy_term_load($terms) {

  // Attach pathauto i18n settings to taxonomy_term object.
  foreach ($terms as $term) {
    $tids[] = $term->tid;
  }
  if (!empty($tids)) {
    $result = pathauto_i18n_load_settings($tids, 'taxonomy_term');
    $settings = array();
    foreach ($result as $record) {
      $settings[$record->entity_id] = $record->path_status;
    }
    foreach ($terms as $tid => $term) {
      if (array_key_exists($tid, $settings)) {
        $terms[$tid]->path['pathauto_i18n_status'] = $settings[$tid];
      }
      else {
        $terms[$tid]->path['pathauto_i18n_status'] = 0;
      }
    }
  }
}