Hello...

A "raw" title option for nodereference tokens is needed for proper use with Pathauto. (Otherwise punctuation is HTML encoded before Pathauto punctuation rules are applied).

Patch included for review..

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Woodside’s picture

Works well for me, thanks!

yched’s picture

Problem with these kind of tokens is that they add a node_load for each token replacement, even if that specific token is not involved...

Moonshine’s picture

Ahh! I was assuming the node was already loaded & cached from the building of $item['view']. Instead it looks like another function is used _nodereference_titles() and it has it's own static cache. :)

I think this should do the trick... It's just really helpful for building out nice parented path aliases.

Moonshine’s picture

Actually should this check isset($item['view']) instead ? Then no query would be run that hasn't already been run for $item['view'] as least. Or perhaps that doesn't matter in the end, as $item['view'] will always be there if there is a nid..

yched’s picture

Smart. Since we render the node to get its tokens, the query will have happened anyway and we don't repeat it (at least if the noderef formatter uses _nodereference_titles(), which is the case of all default formatters).

Should we then also have :

- $tokens['title'] = isset($item['view']) ? strip_tags($item['view']) : '';
+ $tokens['title'] = is_numeric($item['nid']) ? check_plain( _nodereference_titles($item['nid'])) : '';
Moonshine’s picture

Sure... added.. :)

yched’s picture

Status: Needs review » Fixed

You replaced the wrong token ;-)
Fixed and committed. Thanks !

yched’s picture

Forgot to add : I left the sting fixes out for now - we're 'trying' to be in string freeze mode...

Moonshine’s picture

wow.. SORRY :/ I moved too quick. Thanks though!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.