function rules_token_help in Rules Token 8
Same name and namespace in other branches
- 2.x rules_token.module \rules_token_help()
- 1.x rules_token.module \rules_token_help()
Implements hook_help().
File
- ./
rules_token.module, line 77 - Contains rules_token.module.
Code
function rules_token_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the rules_token module.
case 'help.page.rules_token':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= t('The module enables to use in Rules tokens provided by the following modules:');
$output .= '</br>';
$output .= "<a href='https://www.drupal.org/project/token'>'Token'</a>";
$output .= '</br>';
$output .= "<a href='https://www.drupal.org/project/token_custom'>'Custom Tokens'</a>";
$output .= '</br>';
$output .= "<a href='https://www.drupal.org/project/token_custom_plus'>'Custom Tokens Plus'</a>";
$output .= '</br>';
$output .= t('It allows getting values of any Drupal data and use them in Rules.');
$output .= '</br>';
$output .= t('You can get the current date, site URL, webform submissions and so on.');
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= t("The module provides one action, named 'Get token value'.");
$output .= '</br>';
$output .= t("And it provides two conditions, named 'Compare Data with Token' and 'Compare Token with Token'.");
$output .= '</br>';
$output .= t('They are easy to use.');
$output .= '</br>';
$output .= t('You just need to remember that there are two types of tokens:');
$output .= '</br>';
$output .= '<ol>';
$output .= '<li>';
$output .= t('Tokens that related with a context of a current rule event.');
$output .= '</br>';
$output .= t('The examples of such tokens are:');
$output .= '</br>';
$output .= t('[node:],');
$output .= '</br>';
$output .= t('[user:],');
$output .= '</br>';
$output .= t('[webform_submission:]');
$output .= '</br>';
$output .= '</br>';
$output .= t('For such tokens you need to specify the entity to which they are intended.');
$output .= '</br>';
$output .= t("The field named 'ENTITY OF TOKEN' provided for that.");
$output .= '</br>';
$output .= t("You have to switch to the 'Data selection mode'");
$output .= '</br>';
$output .= t("(click on the 'Switch to data selection' button).");
$output .= '</br>';
$output .= t("And then select the relevant entity using the selector.");
$output .= '</br>';
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t('Global tokens that not related with a context.');
$output .= '</br>';
$output .= t('The examples of such tokens are:');
$output .= '</br>';
$output .= t('[date:],');
$output .= '</br>';
$output .= t('[url:],');
$output .= '</br>';
$output .= t('[random:]');
$output .= '</br>';
$output .= '</br>';
$output .= t("For those tokens you don't have to specify any entity.");
$output .= '</br>';
$output .= t("Therefore, you should leave the 'ENTITY OF TOKEN' field empty.");
$output .= '</li>';
$output .= '</ol>';
$output .= '<dl>';
$output .= '<dt><h4>' . t("'Get token value' action") . '</h4></dt>';
$output .= '<dd>';
$output .= t("Let's say you want to get the value of a webform field after a webform submitted.");
$output .= '</br>';
$output .= t("For instance, the name of the webform is 'Contact' and the name of the field is 'Message'.");
$output .= '</br>';
$output .= t('To achieve the goal to do the following:');
$output .= '</br>';
$output .= '<ol>';
$output .= '<li>';
$output .= t("Install the 'Webform' module.");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Create the new rule to react on 'After saving a new webform submission' event.");
$output .= '</br>';
$output .= t("You will find it under 'Webform submission' section of the event list.");
$output .= '</br>';
$output .= t("(be warned, that the 'Rules Webform' module can hide this event).");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Add the 'Get token value' action");
$output .= '</br>';
$output .= t("(you will find it under the 'Data' section of the action list).");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Click inside the 'TOKEN' field to specify the place for the token insertion.");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Then click on the 'Browse available tokens.' link");
$output .= '</br>';
$output .= t("(you will find it under the 'TOKEN' field).");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t('Wait to see the window with the available tokens list.');
$output .= '</br>';
$output .= t('Find the [webform_submission:values:?] token from the appeared window.');
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t('Click on this token.');
$output .= '</br>';
$output .= t("After that, this token will be inserted into the 'TOKEN' field.");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t('Replace the question mark in the token with the webform field key.');
$output .= '</br>';
$output .= t('As a result our token will change to: [webform_submission:values:message]');
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Type the token entity into the 'ENTITY OF TOKEN' field.");
$output .= '</br>';
$output .= t("To do this click on the 'Switch to data selection' button");
$output .= '</br>';
$output .= t("(you will find it under the 'ENTITY OF TOKEN' field).");
$output .= '</br>';
$output .= t("Then select the 'webform_submission' variable from the selector.");
$output .= '</br>';
$output .= t("After that the 'ENTITY OF TOKEN' field will contain the following value:");
$output .= '</br>';
$output .= t('webform_submission');
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Click on the 'Save' button and save the rule.");
$output .= '</br>';
$output .= '</br>';
$output .= '</li>';
$output .= '</ol>';
$output .= t("After that, the new 'token_value' variable will be accessible in the data selector.");
$output .= '</br>';
$output .= t('When the rule run, this variable will contain the value of our token.');
$output .= '</br>';
$output .= t('And you are free to use it in others actions of the rule.');
$output .= '</br>';
$output .= '</br>';
$output .= t('If you need to get the current date or site URL, then select the tokens,');
$output .= '</br>';
$output .= t('for instance, [date:html_date] and [site:url-brief]');
$output .= '</br>';
$output .= t("and leave the 'ENTITY OF TOKEN' field empty.");
$output .= '</br>';
$output .= '</dd>';
$output .= '<dt><h4>' . t("'Compare Data with Token' condition") . '</h4></dt>';
$output .= '<dd>';
$output .= t('For example, you want to compare the current date with a some value.');
$output .= '</br>';
$output .= t('For that you should to do the following:');
$output .= '</br>';
$output .= '<ol>';
$output .= '<li>';
$output .= t("Add the 'Compare Data with Token' condition");
$output .= '</br>';
$output .= t("(you will find it under the 'Data' section of the condition list).");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Input the value to be compared into 'Data' field.");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Click on the 'Browse available tokens.' link");
$output .= '</br>';
$output .= t("(the link is located under the 'TOKEN' field).");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t('Select the appropriate token, for instance, [date:html_date]');
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Because we used the global token, leave the 'ENTITY OF TOKEN' field empty.");
$output .= '</br>';
$output .= '</li>';
$output .= '<li>';
$output .= t("Click on the 'Save' button.");
$output .= '</br>';
$output .= '</li>';
$output .= '</ol>';
$output .= '</dd>';
$output .= '<dt><h4>' . t("'Compare Token with Token' condition") . '</h4></dt>';
$output .= '<dd>';
$output .= t('Use this condition if you need to compare the values of two tokens.');
$output .= '</dd>';
$output .= '</dl>';
return $output;
default:
}
}