You are here

function entity_translation_upgrade_init in Entity Translation 7

Implements hook_init().

File

entity_translation_upgrade/entity_translation_upgrade.module, line 58
Provides permanent redirects for unavailable node translations.

Code

function entity_translation_upgrade_init() {

  // If have a node/$nid path but we are not able to load a node for the given
  // nid we might have an upgraded translation, hence we need to look for a
  // record matching the requested nid in the history table.
  if ($nid = entity_translation_upgrade_check_path() && ($data = entity_translation_upgrade_load($nid))) {
    entity_translation_upgrade_redirect($data->tnid, $data->language);
  }
}