By jurgenhaas on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
2.0.x
Introduced in version:
2.0.0
Issue links:
Description:
Drop-down config fields for condition and action plugins in ECA now also support tokens. Other modules can adopt that behaviour by following this small guide. There are a couple of steps to take:
Build config form
Add the following property to the select field, that should support tokens:
'#eca_token_select_option' => TRUE,
Use the PluginFormTrait
Add the use statement to the plugin class:
use PluginFormTrait;
Retrieve configuration value
When retrieving the configuration value, e.g. in access, execute or evaluate methods, then a token replacement may be required:
$field_name = $this->configuration['field_name'];
if ($field_name === '_eca_token') {
$field_name = $this->getTokenValue('field_name', 'default');
}
Impacts:
Module developers
Site templates, recipes and distribution developers