I just ported a module that uses hook_tokens() and family, and found that there's only a sideways glance to it in the Converting 6.x to 7.x page, and in addition, there's no real handbook or how-to information anywhere that I can find.

I propose these things:

Comments

greggles’s picture

The token example for D6 is the tokenstarterket.module which is in the token project itself.

rfay’s picture

The TOKEN STARTER module has always been an odd duck, showing up for everybody when only developers would be interested. I propose we move it into examples module.

Dave Reid’s picture

@rfay: Completely agreed. I'll work on the token example today.

greggles’s picture

I mostly disagree. A surprisingly large number of people do need to write custom tokens.

rfay’s picture

@greggles, I'm certainly not advocate getting rid of the Token Starter module, just moving it to a place where it's handy for developers and not obtrusive on production sites.

greggles’s picture

AKA a place where it's far less discoverable to the people who need it.

rfay’s picture

IMO a "TOKEN_EXAMPLE.txt" saying where to find the example and a reference in the readme and a reference in the handbook page would do the job.

When Token first came out, it was really important for that to be shipped with the module, because it was developers that were discovering it. But now it's mainstream, installed on (100's of thousands?) of installations, and the token starter probably just confuses most users.

And remember, Token is in core now, and the standard place for core examples is the Examples module. As you know, they used to go into the contrib/documentation area, but they've moved to where they can be maintained and tested properly.

rfay’s picture

Of course, there's a tremendously easy compromise: Just do it both places.

jhodgdon’s picture

Project: Documentation » Drupal core
Version: » 7.x-dev
Component: New documentation » token system
Category: task » bug
Issue tags: -drupal7 +Needs documentation

Moving to core drupal queue, as that is where we monitor the upgrade pages.

Dave Reid’s picture

BTW I've started working on http://drupal.org/handbook/modules/token/update/6/7 already.

rfay’s picture

Your work on token is much appreciated. It would be a horrible backwater without your efforts. Thanks!

jhodgdon’s picture

Where are we on this? Assuming we still need an entry in the 6/7 update guide, adding a tag...

jhodgdon’s picture

Our official position (precedent set by Fields) is that anything that doesn't exist in Core 6.x and now exists in core 7.x does not need to be documented in the 6/7 module update guide page.

So I've added a link at the top of the 6/7 module update page to the page Dave created that documents the changes:
http://drupal.org/documentation/modules/token/update/6/7

Hence, removing the Needs Update Doc tag. I'm not sure what the status of the other parts are:
- Token examples module in Examples for Developers
- Coder module
so I'm leaving the issue open for the moment