This module provides helper functions and quick actions for the ECA (Event, Condition, Action) system in Drupal. It enables users to perform tasks like making HTTP requests, manipulating form elements, managing cookies and headers, and interacting with Drupal services directly within ECA configurations without needing to create custom plugins.
Add helpers functions for ECA
Events
- Preprocess event
- Status message event
Actions:
- Simple http request, if response data is json you can access with [token_name:json:response_data_key]
- Workflow label
- Workflow state
- Get $_SERVER, $_COOKIE, $_SESSION, $_ENV, $_GET, $_POST variable
- Set cookie value for response
- Form Set any form element field value by key
- Form Get any form element field value by key
- Form attach library
- Form add css class
- Form dumper data (dev)
- ThirtPartySetting Get/Set value
- Preprocess Get/Set value for variables
- Preprocess attach library
- Preprocess add css class
- Preprocess remove item
- Headers Set/Remove values
- Add custom tag/script/style to header, body top, body bottom
- Alter status messages
ECA Quick Action
Create quick action for ECA without need define plugin and module.
Create file docroot/sites/eca/EcaActions.php
<?php
/**
* Define the ECA quick actions.
*
* Define action id, label, and callback, service.
*/
function ECAQuickActions(): array {
return [
"hello" => [
"label" => "ECA Action Hello",
"callback" => "eca_quick_actions_hello"
],
"hello_inline" => [
"label" => "ECA Action Inline",
"callback" => function ($hello) {
\Drupal::messenger()->addMessage('Inline callback' . $hello);
}
],
"hello_service" => [
"label" => "ECA Action Call Drupal service",
"service" => "messenger",
"callback" => "addMessage"
]
];
}
function eca_quick_actions_hello($hello) {
\Drupal::messenger()->addMessage('Hello world: ' . $hello);
return "Hello world: " . $hello;
}
Use ECA Helper: Quick Action and choose the ECA Action Hello
SUPPORT DEVELOPMENT
Donation vith Paypal by email: [email protected]