Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Create a custom token in Drupal

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 342
    Comment on it

    Drupal in it's core have lots of tokens which are basically shortcode or placeholder for any kind of information related to Node, User or System itself. Get a complete list of available tokens in Drupal from:

    https://www.drupal.org/node/390482

    If you need a token which is not in this list then you have to create your own. And yes there are HOOKs available in Drupal to create your own token. You have to create following HOOKs in one of your custom module:
    1: hook_token_info
    2: hook_tokens($type, $tokens, array $data = array(), array $options = array())
    3: token_replace($text, array $data = array(), array $options = array())


    For the complete code reference Click here or Click here.

    You can also use Custom Token Module.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: