API page: http://api.drupal.org/api/drupal/includes--token.inc/function/token_find...
Describe the problem you have found:
Code example:
$data = array(
'author:name' => '[node:author:name]',
'title' => '[node:title]',
'created' => '[node:author:name]',
);
$results = token_find_with_prefix($data, 'author');
$results == array('name' => '[node:author:name]');
Should be:
$data = array(
'author:name' => '[node:author:name]',
'title' => '[node:title]',
'created' => '[node:created]',
);
$results = token_find_with_prefix($data, 'author');
$results == array('name' => '[node:author:name]');
Note the changed line: 'created' => '[node:author:name]',
should be 'created' => '[node:created]',
.
Attached patch changes token.inc to correct this. And while I was in there I changed documentation comments to conform to standards, see http://drupal.org/node/1354#functions. Most of the changes are line wraps to keep the comments within 80 columns. A few changes are to fix the tense - e.g. "Replace all tokens ... " was changed to "Replaces all tokens ...". One block was changed to use the correct list format (see http://drupal.org/node/1354#lists).
Comment | File | Size | Author |
---|---|---|---|
token.inc_.doc-standards.patch | 8.26 KB | TR | |
Comments
Comment #1
TR CreditAttribution: TR commentedForgot to tag it as needs review...
Comment #2
jhodgdonThe patch looks good. In the future, it's better to make separate patches for separate issues though. We'll have to see if webchick or Dries is willing to commit a patch that does two separate things for the doc...
Meanwhile, I think it's a good patch and belongs in both d7 and d8.
Comment #3
Dries CreditAttribution: Dries commentedIn this case, I'm comfortable accepting a bigger patch. Committed to 7.x and 8.x.