Once we had this capability and somewhere it got lost. It's not hard to restore, though... while there, we can add the capability to recognize and store properly if user enters an alias. One minor change in the patch, I made router build a very little bit more understandable by putting $move = FALSE close to $move = TRUE.

This will change the path entered by the user to its aliased version. If this is undesired, I can add drupal_get_normal_path calls to menu module.

Comments

chx’s picture

StatusFileSize
new1.26 KB

Actually, changing back to normal path would be a loss in functionality because now you can enter an alias and then move the alias to a different source path and the menu link won't change. I removed one unnecessary hunk from the patch.

dman’s picture

I always liked the idea that I could have a menu or embed link pointed at '/latest-version', '/latest-version' aliased to 'node/77' ... and then next year redirect '/latest-version' to 'node/999'

I always dreaded trying to explain the difference between linking to the node ID and linking to the alias to the content managers, however :)

chx’s picture

dman, this means you like this patch ... or not?

chx’s picture

Title: Store aliased paths for menu » Mass alias menu paths
StatusFileSize
new5 KB

Peter says, aliases have languages. No dice. Let's try this then.

chx’s picture

StatusFileSize
new4.89 KB

Keeping up with HEAD.

pwolanin’s picture

It seems like if we are smart about the path aliases, this could be a big boost.

It seems as though if we run _menu_link_translate and the resulting href is the same as the menu_link, then we can be certain that there is no alias. Is this true?

chx’s picture

StatusFileSize
new4.88 KB

pwolanin is right and yesterday I was wrong when we talked, we only need to check $item['to_arg_functions'] because if that's empty _menu_link_map_translate will not do anything (I thought that % can be replaced to current path parts but that only happens with router items mostly for local tasks). Thus I changed the condition and yes paths without aliases are now set up not to check for an alias again.

pwolanin’s picture

Status: Needs review » Needs work

Fatal error: Unsupported operand types in /Users/Shared/www/drupal6/includes/common.inc on line 1333

I think there is some logic missing - if we odn't have an alias, nor a dynamic arg we must still generate the href.

pwolanin’s picture

StatusFileSize
new5.77 KB

the fatal error was because we need to unserialse() the options array before adding elements to it.

So this one works, but still missing the boo and menu module parts

pwolanin’s picture

doh. I'm not sure this is worth trying to do here. The new language system makes this impossible to do as a simple join.

see: http://api.drupal.org/api/function/drupal_lookup_path/6

  elseif ($count > 0 && $path != '') {
    if ($action == 'alias') {
      if (isset($map[$path_language][$path])) {
        return $map[$path_language][$path];
      }
      // Get the most fitting result falling back with alias without language
      $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s' AND language IN('%s', '') ORDER BY language DESC", $path, $path_language));
      $map[$path_language][$path] = $alias;
      return $alias;
    } 
chx’s picture

Status: Needs work » Closed (won't fix)

No it does not seem possible. Pity.