I have noticed something that looks like an issue in hook_token_values()

If $type = 'node', then $object->taxonomy will have the following expected structure ...

$node->taxonomy => Array
(
  [<tid>] => Term Object
)

Instead, it will be like this ....

$node->taxonomy => Array
(
  [<vid>] => <tid>
)

Where tid is the term id, and vid is the vocabulary id.

Asiby

Comments

aleksey.tk’s picture

I approve this, it is very unexpected behaviour. Imagine that you create your own token with hook_token_list/hook_token_values which will work with taxonomy and will be used to generate an alias to node in pathauto. When you add or update node in hook_token_values you will get $object->taxonomy[vid] = tid. But when you will run bulkupdate from pathauto - you will get $object->taxonomy = array(tid, tid, ...). I understand that this is pathauto related thing, but the problem is deeper - we need normalization of $object in hook_token_values. Something like before running this hook do node_load(nid) or taxonomy_get_term(tid) depending on type of object.

dave reid’s picture

Priority: Critical » Normal
aleksey.tk’s picture

Looks like we will never get an answer here. Maybe let's just close this task?

asiby’s picture

Well, we can check if Drupal 7 has the same issue ... unlikely. And Drupal is already being cooked.

I agree to close it.

asiby’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

No answer received.