Closed (fixed)
Project:
Token
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
2 Nov 2007 at 13:20 UTC
Updated:
21 Mar 2010 at 07:30 UTC
I recently added a feature to pathauto that checks to see if the tokens a user has entered for their pattern make any sense.
It checks for a -raw companion and recommends that (which makes sense mostly just for pathauto)
It checks for whether the token makes sense in the realm (since pathauto specifically only works on node OR taxonomy OR user patterns at any given time).
Something like this should probably be in token (see fago's support)
Comments
Comment #1
fagoindeed a great improvement.
However from a usability point of view it would be much better if not fitting tokens wouldn't even appear in the list. In the case of raw tokens, I would consider this also as a security improvement as it helps avoiding XSS holes created through wrong tokens. So it would be awesome if the caller could say whether it needs raw or formatted tokens and only these are appearing and working.
How do you check if it's a raw token?
Comment #2
gregglesThe code is pretty simple, it's up to the calling function to include the one valid namespace for tokens. Obviously extending that to include multiple namespaces would make sense. I think it's in pathauto.module and is the _pathauto_check_tokens or something like that.
About the raw values - all it does is look at the token - e.g. "title" and then says "if the token doesn't contain '-raw' and if there is a token called 'title-raw' then suggest title-raw"
It relies on the convention of naming tokens with -raw which isn't reliable but is better than nothing.
Comment #3
dave reidBadabing! :)
Outputs:
Comment #4
dave reidCommitted this with a test to HEAD.