Download & Extend

Token rules integration taxonomy fix

Project:Token
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:rules integration

Issue Summary

Rules requires that taxonomy be split into 2 types - term and vocab, but token squashes those into a single entity. This is a simple hack to change the 2 rules taxonomy types to line up with the correct token type.

AttachmentSizeStatusTest resultOperations
token-rules-taxonomy-fix.patch1.11 KBIgnored: Check issue status.NoneNone

Comments

#1

Status:needs review» needs work

As the token taxonomy integration seems to access tid, I think only 'taxonomy_term' should be mapped. Then I think we should add an mapping function, where possible further mappings could be integrated easily. Apart from that the patch also conflicts with the coding standard - please make sure to obey them.

#2

Updated to separate the mapping as a function, which also fixed style issues (i hope!)

AttachmentSizeStatusTest resultOperations
token-rules-taxonomy-fix-2.patch1.38 KBIgnored: Check issue status.NoneNone

#3

Status:needs work» needs review

#4

@fago - we are near a token release. If you want this committed, let me know.

#5

oh, sry for letting this lie so long.

@patch: Data types can be contributed, so this doesn't suffice as contributed types might need that mapping too. I've attached an updated patch, that allows the data type to specify the mapping. Please test if that works for you.

So we'd also need a patch for rules to add the property for the taxonomy type.

AttachmentSizeStatusTest resultOperations
rules_token_tax_fix.patch1.21 KBIgnored: Check issue status.NoneNone
rules_token_tax_fix-rules.patch639 bytesIgnored: Check issue status.NoneNone

#6

Status:needs review» reviewed & tested by the community

Testing and working. Can't argue with making the token type more flexible. No ill effects on existing rules since it falls back to type, and I don't see any performance implications.

#7

Status:reviewed & tested by the community» needs review

Enhanced patch:
Added an if-clause to check if a type is not FALSE. This is useful for rules data types that want to disable token replacements (because they do not provide any). 'token type' => FALSE achieves exactly that.

AttachmentSizeStatusTest resultOperations
token-465434.patch2.91 KBIgnored: Check issue status.NoneNone

#8

Status:needs review» reviewed & tested by the community

Oh, thanks a great addition. I improved the patch for rules to make use of it (see #515608: Allow data types to specify a custom token type). Works fine for me, so let's get it in!

#9

Status:reviewed & tested by the community» fixed

oh, greggles granted me cvs access to commit stuff like this myself. So I've done so :)

Thanks all!

#10

Thank you, fago!

#11

Status:fixed» closed (fixed)

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