You are here

function pathauto_i18n_node_node_load in Pathauto i18n 8

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

Implements hook_node_load().

File

modules/pathauto_i18n_node/pathauto_i18n_node.module, line 42
Provides tools for creating multilanguage aliases for nodes.

Code

function pathauto_i18n_node_node_load($nodes, $types) {

  // Attach pathauto i18n settings to node object.
  foreach ($nodes as $node) {
    $nids[] = $node->nid;
  }
  if (!empty($nids)) {
    $result = pathauto_i18n_load_settings($nids, 'node');
    $settings = array();
    foreach ($result as $record) {
      $settings[$record->entity_id] = $record->path_status;
    }
    foreach ($nodes as $nid => $node) {
      if (array_key_exists($nid, $settings)) {
        $nodes[$nid]->path['pathauto_i18n_status'] = $settings[$nid];
      }
      else {
        $nodes[$nid]->path['pathauto_i18n_status'] = pathauto_i18n_get_bundle_default('node', $node->type);
      }
    }
  }
}