New Video Tutorials on Drupal 7's Token API

This week we're releasing a new series of video tutorials entirely devoted to using the Drupal 7 Token API. This series covers everything you need to know about creating, exposing, and using tokens in your Drupal modules. Since tokens can be a bit confusing, we kick things off with a presentation that covers what tokens are, some history, what problems tokens solve, and the token syntax. This is followed by the Drupal 7 Tokens Site Setup lesson that walks through the specific use-case that we'll be solving for in this series and a demonstration of the end result so that if you're following along you'll know where we're headed.

Once we get some of the prerequisites and background information out of the way, things get really fun. We'll walk through implementing hook_token_info() and providing placeholder tokens for the data contained within a custom module. Of course placeholders are only half of the puzzle so we need to provide values for placeholder tokens by implementing hook_tokens().

Another thing that we'll want to be able to do in our custom modules is allow for someone to use the new tokens we've created, or any token for that matter, in the various configuration forms provided by our module. So we've got a lesson dedicated to replacing placeholder tokens used in a string of text with their dynamic values. Finally, we'll wrap things up by taking a look at the additional hooks the token module from contrib provides for module developers in the lesson on integrating with the token module from contrib.

I had a lot of fun researching and putting this series together. It gave me the chance to spend some quality time with my friend and the token module's maintainer, Dave Reid. I bribed him for adivce by promising to help update the documentation on drupal.org and he kindly obliged. As a result, this series is packed full of great information right from the source. I hope you enjoy learning about Drupal 7's Token API and that when the time comes, you can make use of it in your own code.

Next week, we'll be releasing video tutorials from our partner, KnpUniversity, with lessons on Composer, and Dependency Injection and Namespaces in PHP.

Add new comment

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code class> <ul type> <ol start type> <li> <dl> <dt> <dd><h3 id> <p>
  • Lines and paragraphs break automatically.

About us

Drupalize.Me is the best resource for learning Drupal online. We have an extensive library covering multiple versions of Drupal and we are the most accurate and up-to-date Drupal resource. Learn more