Submitted byadmin onTue, 09/03/2019 - 13:12

Image removed.

Token is one of the 3 most popular modules in Drupal.

It allows you to use small placeholders to automatically complete tasks.

To take a simple example, if you put [site:name] on your site, it will be replaced by the actual name of your site. To take a more complicated example, you can use Token together with the Pathauto module to automatically create URL patterns for your whole site.

However, Token needs other modules to work. If you want to use Token inside fields, there are several options but one of the most reliable is a module called Token Filter.

Image removed.

If you have Token and Token Filter enabled, here's how to add tokens to your fields:

  • Go to Configuration > Text formats
  • Click "Configure" next to the text format you want to use. Be careful with this - do not choose a text format that your regular site visitors will be able to use.
  • Check the "Replace tokens" box, as in the image below.
  • Click "Save Configuration".
Image removed.
  • Go to Structure > Content types > Manage fields
  • Click "Edit" next to a field
  • There will be a "Browse available tokens" option.
Image removed.
  • You can use these tokens to set up default values for your fields:
Image removed.

It's worth noting that some fields types use the "Plain text" format, by default. So, make sure you have token support available for Plain text if needed.

However, be careful with this. Remember that you don't want to give token access to anyone on your site. In the wrong hands, tokens could expose private information.

Image removed.
Solutions Img