Changes to Rules in Drupal 8
This documentation needs work. See "Help improve this page" in the sidebar.
Right now I'm using this page to hold things I've cut and pasted from the issue queue. I will be revising it in the future so it is more organized and usable.
This is NOT intended to be a list of bugs or not-as-yet implemented features in D8. Those things should be handled in the issue queue, and the issue queue should be searched and read to determine the current state of the D8 port.
Instead, this page should list actual intentional changes from D7. For example:
One of the big changes in the UI in Drupal 8 is that Rules now uses Twig-style tokens. So use {{ node.title }} for example, NOT [node:title]. Tokens provided by the Token module cannot be used and are not needed - Rules tokens gives you access to all the data in an object, and does it in a manner that preserves data types. (With the Token module, every token is a string ...).
To find the available tokens for use in your Rule, use the data selector to see the available context data and drill down to what you want, then you can use that piece of data as a token in direct input mode. Again, this is very similar to D7, just with a different syntax and without the "Replacements" list to help you yet in D8.
But one thing that hasn't changed is that if you want to use a piece of data it has to be in context. For example, when you react on a "After saving a new comment" event, the only thing that event gives you is the comment entity. You don't have immediate access to the node, so {{ node.title }} for example won't work - you won't see that as an option in the data selector either, that's how you know it's not available.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion