2

I have a Panel Page set up with the path node/%node/foo and all works fine when I visit a link such as node/6/foo. However, when I visit nodealias/foo it doesn't work at all. Is it possible to get panels to work with pathauto in this way?

I am thinking I may have to implement the hook hook_url_inbound_alter and change the url myself.

I also posted a support request in the panels module here: http://drupal.org/node/1219796

Finbarr
  • 31,350
  • 13
  • 63
  • 94

4 Answers4

2

As Alexey answers panels doesn't care about aliases, it only sees node/%nid Here's a good explanation that is valid still for D7: http://drupal.org/node/211338 To summarize and bring it up to date for D7: Export your variant for the panel you've created and import it into the panel that overrides the default node display in Drupal. Add Criterias to the variant so the Panel/variant is only used for the type(s) of content you want to display with this variant. Voila :) (read the discussion at the link, else the summary will be difficult to understand)

Hope this helps - I myself have spend some time googling and trying to understand this, and I was also confused by the fact that Views DOES care about aliases...

Anders
  • 21
  • 2
  • Same here, I have wrestled with this problem for more time than I will admit, before realizing I had made the same assumption regarding aliases because of Views. – Ashlar Nov 15 '11 at 03:11
1

You can use this module Subpathauto

it automatically makes the alias to work with subpaths, such as: nodealias/foo

Turtletrail
  • 103
  • 1
  • 3
1

I fixed this using the following code, you would need to alter the pattern to match the pattern of your url aliases and alter the function name to match your module's name.

function brooklands_url_inbound_alter(&$path, $original_path, $path_language) {
    $pattern = '#^works\/[A-Za-z0-9]+(-[A-Za-z0-9]+)*\/images(\/\d+)?$#';
    if(preg_match($pattern, $original_path)) {
        $snip = substr($original_path, 0, strrpos($original_path, '/images'));
        $system_path = drupal_lookup_path('source', $snip);
        if($system_path) {
            $tail = substr($original_path, strrpos($original_path, '/images'));
            $path = $system_path . $tail;
        }
    }
}
Finbarr
  • 31,350
  • 13
  • 63
  • 94
0

The nodealias is the full alias of your node with nid=6. The third argument (foo) is added through hook_menu() by panels module to the exact alias (node/%nid/%anythingelse) and it is NOT applied to your aliased URL, so you can not use nodealias/foo url to access your panel just because it is not 'hooked' by panels module. Changing url manually is a good idea, I think.

Alex Smirnoff
  • 478
  • 4
  • 10