This patch allows the user to configure the case that pathauto uses for each substitution.

Putting in a placeholder as all lowercase (eg, [title]) results in the value being converted to lowercase; putting in the placeholder as uppercase (eg, [TITLE]) results in the value being uppercase, and using mixed case (eg, [Title] or [titLE] etc) results in the original case being used.

For example, having a path like:

[Vocab]/[catpath]/[FIELD_SKU]

results in:

Products/gloves/mittens/WLMITLGYEL

The rationale behind this is I was basically doing the above, using the SKU as a path component, however, it defaulted to being lowercase which doesn't look quite right.

Of course if implemented on a site already using pathauto, it defaults to using lowercase conversion just like it always has.

CommentFileSizeAuthor
pathauto.module_16.patch2.73 KBgregmac

Comments

cwgordon7’s picture

Project: » Pathauto
Version: » 5.x-1.2

I think this is a good idea, but it has been posted the wrong module. It should either be in the pathauto issue queue or the token issue queue. I am moving it now. As your patch applies to the pathauto module, I am moving it there. I am not sure what version you are referring to, so if I categorize it wrongly, I apologize.

-cwgordon7

greggles’s picture

Version: 5.x-1.2 » 5.x-2.x-dev
Status: Needs review » Needs work

This is a very interesting idea.

This patch needs some help to get it to follow the code standards, but I do like the idea. See the coder module http://drupal.org/project/coder and the coding standards http://drupal.org/coding-standards for some details. In particular your help text is formatted in an abnormal manner and does not use the t() localization system.

Also, this patch is against the 5.x-1.x branch of the module which is closed for features. Can you update it to the 5.x-2.x branch?

The 5.x-2 branch already has a radio button that will leave case alone or lower case everything, so your patch should also remove that. Finally, this may not even be possible in 5.x-2 because of the token system. I'm not sure how strtr will handle this.

dave reid’s picture

Title: User-configurable letter case for each placeholder » Upper/lower/sentence case modifiers for tokens
Project: Pathauto » Token
Version: 5.x-2.x-dev » 6.x-1.x-dev

It's probably more likely we could use something like [title:ucfirst] (upper-case first) or [title:ucall] (upper-case all). How the heck would [TitLE] work with a node title like 'This is a completely random node title.'. This would need to be added in Token or the Core D7 Token system.

dave reid’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs work » Postponed

Marking as postponed and for D7 since this wouldn't be possible with the D6 implementation.

dave reid’s picture

Status: Postponed » Closed (won't fix)

I don't know how we can do this, so marking as won't fix.

Drupa1ish’s picture

Issue summary: View changes

For pathauto at admin/config/search/path/settings we have Character case: change to lower case

nithinkolekar’s picture

boom :)
https://www.drupal.org/project/token_modifier

For example: output the current users' username as title case:

[token-modifier:title-case:current-user:name]