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?

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

2 Answers 2

8

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.

4
  • 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, 2010 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, 2010 at 19:02
  • Have a look at the API.txt in the token module, which explains about hook_token_values() and hook_token_list(). Oct 27, 2010 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, 2012 at 4:01
0

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

1
  • 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. Apr 29, 2015 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.