Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
6ccd09dc
Commit
6ccd09dc
authored
Jan 5, 2010
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#113614
follow-up by eaton: Commit missing token API documentation.
parent
bb293ccf
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/system/system.api.php
+61
-0
61 additions, 0 deletions
modules/system/system.api.php
with
61 additions
and
0 deletions
modules/system/system.api.php
+
61
−
0
View file @
6ccd09dc
...
@@ -2905,6 +2905,67 @@ function hook_username_alter(&$name, $account) {
...
@@ -2905,6 +2905,67 @@ function hook_username_alter(&$name, $account) {
}
}
}
}
/**
* Provide replacement values for placeholder tokens.
*
* @param $type
* The type of token being replaced. 'node', 'user', and 'date' are common.
* @param $tokens
* An array of tokens to be replaced, keyed by the literal text of the token
* as it appeared in the source text.
* @param $data
* (optional) An array of keyed objects to be used when generating replacement
* values.
* @param $options
* (optional) A keyed array of settings and flags to control the token
* replacement process. Common options are:
* - 'language' A language object to be used when generating locale-sensitive
* tokens.
* - 'sanitize' A boolean flag indicating that tokens should be sanitized for
* display to a web browser.
* @return
* An associative array of replacement values, keyed by the original 'raw'
* tokens that were found in the source text. For example:
* $results['[node:title]'] = 'My new node';
*/
function
hook_tokens
(
$type
,
$tokens
,
array
$data
=
array
(),
array
$options
=
array
())
{
// TODO: sample code demonstrating simple tokens and use of token chaining
}
/**
* Provide metadata about available placeholder tokens and token types.
*
* @return
* An associative array of available tokens and token types, each containing
* the raw name of the token or type, its user-friendly name, and a verbose
* description.
*
* For example:
* @code
* $data['types'] = array(
* 'site' => array(
* 'name' => t('Site information')
* 'description' => t('Tokens for site-wide settings and other global information.'),
* ),
* );
*
* $data['tokens']['site'] = array(
* 'slogan' => array(
* 'name' => t('Slogan')
* 'description' => t('The slogan of the site.'),
* ),
* 'login-url' => array(
* 'name' => t('Login page')
* 'description' => t('The url of the site login page.'),
* ),
* );
* @endcode
*/
function
hook_token_info
()
{
// TODO: sample code building token information
}
/**
/**
* @} End of "addtogroup hooks".
* @} End of "addtogroup hooks".
*/
*/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment