Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have created a rule to email some fields after a node is created.
Most fields are displayed correctly in the emails except for those that are terms in a vocabulary.
Example Content:
Create New Content of Car
Manufacturer of Car: Ford, GM, or Chrysler (terms in the vocabulary manufacturer)
Example Rule:
action "Send mail" Subject: A new [node:field-manufacturer] Car.
The replacement token is not returning a value and displaying an error:
Warning: Illegal offset type in _entity_token_get_token() (line 144 of /var/www/html/drupal-7.0/sites/all/modules/entity/entity_token.tokens.inc).
Does anyone have a way of displaying the correct vocabulary term in a rule?
Comment | File | Size | Author |
---|---|---|---|
#5 | entity_term_token.patch | 971 bytes | fago |
Comments
Comment #1
Itangalo CreditAttribution: Itangalo commentedComment #2
fagoI guess you should use the term name by using [node:field-manufacturer:name]
Comment #3
worldlinemine CreditAttribution: worldlinemine commentedWhen using modules such as auto_nodetitle when they attempt to use the token associated with a field they are not properly capturing the syntax ie.:
[node:field-manufacturer] vs [node:field-manufacturer:name]
I am also seeing a similar issue in looking at the token through the devel module (the token for a taxonomy appears blank).
But I have confirmed that by using the indicated syntax it is properly making use of the token and exposing its value.
This leads me to the question: Is there a need to document how the use of tokens has changed or if this is already documented is there a need to share this information with module developers who are utilizing entities/tokens?
Comment #4
waverate CreditAttribution: waverate commentedFantastic.
Syntax at #2 is the solution.
How does this solution get back to the Rules module so that the Replacement Patterns can be updated?
Comment #5
fagoWe need to fix it, so it works without :name too. Attached patch should do so, please test.
Comment #6
Jerome F CreditAttribution: Jerome F commentedI tried to use this patch (#5) with Automatic Nodetitles module. The string [node:field-deal-destination-city] is still printed as is, as plain text instead of the term name. Perhaps because I use internationalisation.
[node:field-deal-destination-city:i18n-name] works ok
I come from this issue http://drupal.org/node/1149400 marked as duplicate
Comment #7
fagoor, maybe you were trying a multiple field? see #1058856: Entity tokens not created for multi-value fields
Anyway, I tested it and it seem to work fine. Thus, committed.
Comment #8
fagoComment #9
artatac CreditAttribution: artatac commentedtested using latest dev, ran update.php and flushed caches - still getting
Comment #10
fagoad #9: If that's not something that happens with term tokens, please open another issues. How can one reproduce this?