? 940762-domain-path-new.patch Index: domain.api.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.api.php,v retrieving revision 1.1.2.4 diff -u -p -r1.1.2.4 domain.api.php --- domain.api.php 10 Dec 2010 18:35:26 -0000 1.1.2.4 +++ domain.api.php 10 Dec 2010 20:11:48 -0000 @@ -592,19 +592,25 @@ function hook_domain_bootstrap_full($dom * Prefix, we only include this function if we know it is necessary. * * @see domain_prefix_init() + * @see hook_url_outbound_alter() * * @param $domain_id * The domain_id taken from {domain}. * @param $path * The internal drupal path to the node. - * @param $path_language - * Language code to look up the path in. + * @param $options + * The path options. + * @param $original_path + * The raw path request from the URL. * * @ingroup domain_hooks */ -function hook_domainpath($domain_id, &$path, $path_language = '') { +function hook_domainpath($domain_id, &$path, &$options, $original_path) { // Give a normal path alias $path = drupal_get_path_alias($path); + // In D7, path alias lookups are done after url_alter, so if the + // alias is set, the option must be flagged. + $options['alias'] = TRUE; } /** Index: domain.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.module,v retrieving revision 1.190.2.22 diff -u -p -r1.190.2.22 domain.module --- domain.module 10 Dec 2010 18:27:21 -0000 1.190.2.22 +++ domain.module 10 Dec 2010 20:11:51 -0000 @@ -1351,21 +1351,25 @@ function domain_get_path($domain) { * Determine an absolute path to the current page * * @param $domain - * The currently active $domain array, provided by domain_lookup(). + * The currently active $domain array, provided by domain_lookup(). * @return - * The absolute url to the current page on the requested domain. + * The absolute url to the current page on the requested domain. */ function domain_get_uri($domain) { + global $base_path; $request_uri = request_uri(); $modules = _domain_path_modules(); if (!empty($modules) && !drupal_is_front_page()) { // If needed, let modules modify the path alias. - $alias = domain_path($domain['domain_id'], $_GET['q']); + $request_uri = str_replace($base_path, '', $request_uri); + $request_uri = trim($request_uri, '/'); + // We cannot use URL here because we need the domain_id data. + // TODO: use url() but pass a domain_id option? + domain_path($domain['domain_id'], $request_uri, $options, $request_uri, $_GET['q']); // Run the result through url() for proper language and path handling. - $request_uri = url($alias); + $request_uri = url($request_uri, $options); } - - $path = domain_check_scheme($domain['scheme']) . '://' . $domain['subdomain'] . $request_uri; + $path = check_url($domain['scheme'] . '://' . $domain['subdomain'] . $request_uri); return $path; } @@ -2682,16 +2686,15 @@ function domain_warning_check($form_id) * @return * The $path, modified by reference by hook_domainpath() implementations. */ -function domain_path($domain_id, $path, $path_language = '') { +function domain_path($domain_id, &$path, &$options, $original_path) { $modules = _domain_path_modules(); if (!empty($modules)) { foreach ($modules as $module) { // Cannot use module_invoke_all() since these are passed by reference. $function = $module . '_domainpath'; - $function($domain_id, $path, $path_language); + $function($domain_id, $path, $options, $original_path); } } - return $path; } /** Index: settings_custom_url.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/domain/settings_custom_url.inc,v retrieving revision 1.30 diff -u -p -r1.30 settings_custom_url.inc --- settings_custom_url.inc 1 Apr 2010 21:08:36 -0000 1.30 +++ settings_custom_url.inc 10 Dec 2010 20:11:51 -0000 @@ -127,13 +127,13 @@ function domain_url_outbound_alter(&$pat // TODO: merge this code with the above for cleanup. } } - // We may have to Implements hook_domainpath(). + // We may have to refactor this for D7. if (!isset($path_rewrite)) { $path_rewrite = count(_domain_path_modules()); } - // Allow path changes, if needed. + // Allow path changes, if needed. This changed significantly in D7. if ($path_rewrite > 0 && $path != '') { - $path = domain_path($target_domain_id, $original_path, isset($options['language']) ? $options['language']->language : ''); + domain_path($target_domain_id, $path, $options, $original_path); } } }