-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support old hyphenated tokens (field-tags) in addition to current underscored (field_tags) #144
Comments
To clarify, not all tokens in Backdrop use underscores. Only tokens of Field API fields do. D7 Entity Tokens used to provide a second token for each field that was dashed. This was changed in Backdrop's port of Entity Tokens to match the core's field tokens, which use underscore (NB: field tokens provided in core are pretty limited and can't be chained, which is why Entity Tokens is still needed with Rules). Your No. 2 option above is better done in Entity Tokens rather than in Rules, since Rules simply invokes |
The latest release of Entity Tokens (1.x-2.0.0-rc1) now supports hyphenated field tokens (both chained or unchained, as in [node:field-tags] and [node:field-tags:0]). This means that these tokens are also available to Rules in Direct Input text areas. However, since underscores are still the "official" pattern supported in core, the token list shown in "Replacement patterns" still shows only the ones with underscores, i.e. [node:field_tags:0] etc. But the ones with dashes will be fulfilled, which improves compatibility with D7 Rules when imported. Posting deprecated watchdog messages was too complicated for Entity Tokens to handle, since it's unclear whether a token is really deprecated. Dashes are still legit (not deprecated) in certain core tokens like [node:comment-count]. Therefore throwing a notice for that would actually be incorrect. Tokens are fulfilled in different places (by hook_tokens in several modules), and it's impossible for one implementation of that hook to "know" whether another one has fulfilled a legit token with dashes. And, a bogus token like [node:field-bogus] may throw a deprecated notice, while in fact the real problem is that it doesn't exist. |
I'm confused about trying to access an image field. In D7 I could use [node:field-image:file:url]. I try that in Backdrop and I get an empty email(my rules action is send an html email). Interestingly it works when I use data selection input node:field-image:file:url. Having that gives me the url in an email. But when I go back to direct input it no longer works. I'm wanting to do this sort of thing in the HTML body but the image is always missing in Backdrop. |
There are several parts to my answer:
In Backdrop core, image tokens require the style. So your token will look something like (note the low hyphen):
This will give you the path for the "medium" style. Replace with needed style. I hope that helps... |
I need to clarify that Backdrop Entity Tokens now provide the option of using regular hyphens (as in I know, it's confusing, but the token replacement API is pretty primitive in Backdrop/Drupal, and the fact that SOME field tokens from the D7 contrib Token were integrated into core in Backdrop (as patch work), did not help. I was forced to completely skip image field tokens in Entity Tokens to prevent errors. |
I'm still not getting the actual image. Now I get a link to the image style. |
How about we look at this during office hours? |
Yes! |
Many tokens that were hyphenated in Drupal 7 are now underscored in Backdrop, e.g.,
field-tags
is nowfield_tags
. For Rules imported from D7, the old-style tokens will no longer render. Users will need to update their Rules.Things we could consider doing to help them out:
The text was updated successfully, but these errors were encountered: