3

I use the Rules module. I want to add 1 to a CCK integer field on an action. Someone told me to create a custom token doing this addition.

So, I installed the tokenSTARTER module.

Now, how do I access the content profile (I load it in the rules chain) where the needed CCK field is in?

  • What exactly does the token need to output? Doesn't the Token module, or the CCK module provide a token for that? – kiamlaluno Apr 29 '12 at 11:58
7

This module is very good for that: Custom Tokens.

It gives the user the ability to create custom tokens for specific replacements that can improve other modules relying on the Drupal 7 token API or, for Drupal 6, the Token module.

|improve this answer|||||
  • How do I access the right field from the content_profile? I still need drupal api knowledge to do it. This module doesn't help me.. – EugenA Jun 15 '10 at 16:09
  • That module is good for creating custom tokens. I only need to create one though, and I'd prefer the PHP that generates the value for the token be in SVN not in the database. Does anyone have a simple example of how to create your own custom token? – Aaron Oct 26 '10 at 19:02
  • Have a look at the API.txt in the token module, which explains about hook_token_values() and hook_token_list(). – lazysoundsystem Oct 27 '10 at 19:32
  • 3
    If you need an example of a token to work from, checkout the examples module drupal.org/project/examples and the token_example module. Thats a quick way to learn how to create tokens. – schnippy Feb 7 '12 at 4:01
0

Look for creation custom token for Drupal 7 at https://www.drupal.org/node/1308488

|improve this answer|||||
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Krishna Mohan Apr 29 '15 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy