You are here

function domain_path_domainpath in Domain Path 6

Same name and namespace in other branches
  1. 7 domain_path.module \domain_path_domainpath()

Implements hook_domainpath().

File

./domain_path.module, line 18
Path alias handling for multiple domains.

Code

function domain_path_domainpath($domain_id, &$path, $path_language = '') {
  $domain = domain_get_domain();
  $did = $domain['domain_id'];
  $alias = $path;
  $paths = domain_path_paths('alias');
  if (isset($paths[$path][$did])) {
    $alias = $paths[$path][$did];
    $nid = arg(1, $alias);
  }
  else {
    $nid = domain_path_is_node_path($alias, $path_language);
    $alias = "node/{$nid}";
  }
  if (empty($nid)) {
    return;
  }
  $paths = domain_path_paths('nid', $nid);
  if (isset($paths[$domain_id])) {
    $path = $paths[$domain_id];
  }
  else {
    $path = drupal_get_path_alias($alias, $path_language);
  }
  $options['alias'] = TRUE;
}