It seems like drupal_match_path() would be more useful if it also matched path aliases of the given path.
Seeing as the path and the alias both match the same page I would think in most, if not all, cases you would want the alias to match also.
If not, maybe an additional boolean parameter for the function could determine whether or not it matches aliases?
The only functions that are listed as calling drupal_match_path() are path_is_admin() & block_block_list_alter() - and block_block_list_alter() already has it's own additional code to handle path aliases, which could potentially be removed if it were in drupal_match_path().
My use case is the overlay.
Using hook_admin_paths() I add the user account pages like
<?php
function hook_admin_paths_alter(&$paths) {
// Treat all user pages as admin pages.
$paths['user'] = TRUE;
$paths['user/*'] = TRUE;
// We need to specifically add path aliases as well.
$paths['users/*'] = TRUE;
// Not the logout page as that looks odd.
$paths['user/logout'] = FALSE;
}
?>
I have to specifically add the path alias for user/* here or it doesn't work when there are aliases.
It is not that much of an issue for me to add the extra line in this case but it seems like a flaw as if I want the page in the overlay I want it there on the alias or not.
Also, alias changes are possible and could cause problems.
If this is not desirable for any reason then at least the documentation page for hook_admin_paths() should mention that aliases must be specifically added.
Comments
Comment #9
quietone CreditAttribution: quietone as a volunteer commenteddrupal_match_path was removed from Drupal 8.0.x in #2388631: Remove drupal_match_path(). and the use case here is for overlay. Because of that moving this back to the Drupal 7.