The Action module provides tasks that can be executed by the website such as unpublishing content, sending an email, or banning a user. Other modules can fire these actions when certain system events happen; for example, when a new post is added or when a user logs in. Modules may also provide additional actions. Action is a core module in Drupal 8 and later.
To configure actions, navigate to /admin/config/system/actions.
There are two types of actions: simple and advanced. Simple actions do not require any additional configuration and are listed here automatically. Advanced actions need to be created and configured before they can be used because they have options that need to be specified; for example, sending an e-mail to a specified address or unpublishing content containing certain words.
From the Actions page you can configure or create actions. To create an advanced action, select the action from the drop-down list in the advanced action section and click the Create button.
Declaring action functions
Action functions are declared by modules by implementing hook_action_info(). Modules can cause action functions to run by calling actions_do().
Each action function takes two to four arguments:
- - $entity: The object that the action acts on, such as a node, comment, or user