I have the following in a theme function:

dpm(request_path());
dpm(current_path());

File paths are the only places where I'm not getting the expected result (path alias & un-aliased path), instead I just get nothing. Tested in Bartik & Omega 4.

Am I missing something here?

Comments

dddbbb’s picture

Update: This works fine if the code is placed in a custom module. The issue only seems to arise if it's attempted at the theme level.

dddbbb’s picture

Title: current_path() & request_path() return nothing when viewing a file entity » Calling current_path() or request_path() from the theme returns nothing when viewing a file entity

Updated issue title

Dave Reid’s picture

Status: Active » Closed (cannot reproduce)

I cannot duplicate this with a fresh install of core + File entity. My results for a file aliased as 'file/ceilingcatnotextgif' returned the following results using the two dpm() calls above:

file/ceilingcatnotextgif
file/1

Worth asking, you know you won't see the dpm() messages in any tpl.php files until the *next* page load right? So you have to reload the page to see what the previous page output. Sometimes that gets me off track so just wanted to check that's not the case.

dddbbb’s picture

Thanks Dave, I'll take another look with that in mind.

dddbbb’s picture

Sorry Dave, I've just tried this again since your response and all seems to be working fine. Not sure what caused the initial problem but it seems to have been fixed in the time that's passed.