Token rules integration taxonomy fix

fearlsgroove - May 17, 2009 - 22:10
Project:Token
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:rules integration
Description

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.

AttachmentSize
token-rules-taxonomy-fix.patch1.11 KB

#1

fago - May 18, 2009 - 09:40
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

fearlsgroove - May 19, 2009 - 17:40

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

AttachmentSize
token-rules-taxonomy-fix-2.patch 1.38 KB

#3

fearlsgroove - May 19, 2009 - 17:41
Status:needs work» needs review

#4

greggles - May 20, 2009 - 00:37

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

#5

fago - July 10, 2009 - 13:20

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.

AttachmentSize
rules_token_tax_fix.patch 1.21 KB
rules_token_tax_fix-rules.patch 639 bytes

#6

fearlsgroove - August 4, 2009 - 14:04
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

klausi - August 5, 2009 - 13:36
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.

AttachmentSize
token-465434.patch 2.91 KB

#8

fago - August 5, 2009 - 17:02
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

fago - August 5, 2009 - 17:18
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

greggles - August 5, 2009 - 23:01

Thank you, fago!

#11

System Message - August 19, 2009 - 23:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.