### Patch 1.0 #P Custom Breadcrumb Index: www/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs.module =================================================================== --- www/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs.module (révision 3864) +++ www/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs.module (copie de travail) @@ -524,6 +524,13 @@ // Decode title to properly handle special characters. $title = decode_entities($title); + + // Parse the original path + $parsed_original_path = parse_url($original_path); + + // Ensure we use only the path part of the URL for following filters + $original_path = $parsed_original_path['path']; + // Collapse double slashes to one. $original_path = preg_replace('/\/+/', '/', $original_path); // Removing leading and trailing slashes. @@ -556,10 +563,25 @@ } $options = parse_url($path); $options = array_merge($options, $attributes); + + // By default href used is only the path part of the URL (default behavior for relative paths) + $href = $options['path']; + + // If the original path contains a scheme and a domain, it's an absolute URL, so we generate an absolute link + if (isset($parsed_original_path['scheme']) && isset($parsed_original_path['host'])) { + // Preparing URL components + $href_scheme = $parsed_original_path['scheme']; + $href_host = $parsed_original_path['host']; + $href_port = (isset($parsed_original_path['port']) ? ":".$parsed_original_path['port'] : ""); + + // Constructing href value + $href = $href_scheme."://".$href_host.$href_port."/".$href; + } + $crumbs[] = array( - 'crumb' => l($title, $options['path'], $options), + 'crumb' => l($title, $href, $options), 'title' => $title, - 'href' => $options['path'], + 'href' => $href, ); }