Module Description
This module extends the 'Rules' module for Drupal 8/9. The module enables to use in Rules tokens provided by the following modules: 'Token' 'Custom Tokens' 'Custom Tokens Plus' 'Advanced Entity Tokens'

It allows getting values of any Drupal data and use them in Rules. You can get the current date, site URL, webform submissions and so on.

Recommended modules 'Rules Data Exchanger' enables to exchange data between Rules and rules Components in Drupal 8. It's allows to store any data of a some Rule and then use them in others Rules or Components.

Uses
The module provides one action, named 'Get token value'. And it provides two conditions, named 'Compare Data with Token' and 'Compare Token with Token'. They are easy to use. You just need to remember that there are two types of tokens:


* Tokens that related with a context of a current rule event. The examples of such tokens are:   [node:],   [user:],   [webform_submission:] For such tokens you need to specify the entity to which they are intended. The field named 'ENTITY OF TOKEN' provided for that. You have to switch to the 'Data selection mode' (click on the 'Switch to data selection' button). And then select the relevant entity using the selector.


* Global tokens that not related with a context. The examples of such tokens are:   [date:],   [url:],   [random:] For those tokens you don't have to specify any entity. Therefore, you should leave the 'ENTITY OF TOKEN' field empty.

'Get token value' action Let's say you want to get the value of a webform field after a webform submitted. For instance, the name of the webform is 'Contact' and the name of the field is 'Message'. To achieve the goal to do the following:


* Install the 'Webform' module.
* Create the new rule to react on 'After saving a new webform submission' event. You will find it under 'Webform submission' section of the event list. (be warned, that the 'Rules Webform' module can hide this event).
* Add the 'Get token value' action (you will find it under the 'Data' section of the action list).
* Click inside the 'TOKEN' field to specify the place for the token insertion.
* Then click on the 'Browse available tokens.' link (you will find it under the 'TOKEN' field).
* Wait to see the window with the available tokens list. Find the [webform_submission:values:?] token from the appeared window.
* Click on this token. After that, this token will be inserted into the 'TOKEN' field.
* Replace the question mark in the token with the webform field key. As a result our token will change to: [webform_submission:values:message]
* Type the token entity into the 'ENTITY OF TOKEN' field. To do this click on the 'Switch to data selection' button (you will find it under the 'ENTITY OF TOKEN' field). Then select the 'webform_submission' variable from the selector. After that the 'ENTITY OF TOKEN' field will contain the following value: webform_submission
* Click on the 'Save' button and save the rule.

After that, the new 'token_value' variable will be accessible in the data selector. When the rule run, this variable will contain the value of our token. And you are free to use it in others actions of the rule.

If you need to get the current date or site URL, then select the tokens, for instance, [date:html_date] and [site:url-brief] and leave the 'ENTITY OF TOKEN' field empty.

'Compare Data with Token' condition For example, you want to compare the current date with a some value. For that you should to do the following:


* Add the 'Compare Data with Token' condition (you will find it under the 'Data' section of the condition list).
* Input the value to be compared into 'Data' field.
* Click on the 'Browse available tokens.' link (the link is located under the 'TOKEN' field).
* Select the appropriate token, for instance, [date:html_date]
* Because we used the global token, leave the 'ENTITY OF TOKEN' field empty.
* Click on the 'Save' button.

'Compare Token with Token' condition Use this condition if you need to compare the values of two tokens.

Project Usage
652
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to solve the issue of using tokens provided by various modules in Rules for Drupal 8/9, allowing users to get values of any Drupal data and use them in Rules easily.
Data Name
rules_token

OPENAI CHATBOT

OPENAI CHATBOT

14:28:05
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.