drupal-eca-recipe/eca_lib_0004
最新稳定版本:3.2.3
Composer 安装命令:
composer require drupal-eca-recipe/eca_lib_0004
包简介
Switch Case Default
README 文档
README
ID: eca_lib_0004
Demonstrate how typical switch-case PHP constructors could be simulated in ECA models - similar to if-elsif-else statements.
The model is similar to what you would normally do in PHP like this:
switch ($field_select) {
case 'a1':
case 'a2':
case 'a3':
case 'c7':
// Set Status to 3
$field_status = 3;
case 'b1':
case 'b2':
// Set Status to 4
$field_status = 4;
default:
// Set default Status
$field_status = 2;
}
Important note: after the action "Set default Status to 2", ECA first checks the conditions of ALL successors; only then does it execute the actions that follow for those conditions that return TRUE. That's why the "no condition" link has no condition, as we want to execute that path in any case, but not before the top two paths had a chance to change the status. Therefore the condition, if the status is still 2, happens with a delay, i.e. really after everything else has been completed.
Installation
## Import recipe
composer require drupal-eca-recipe/eca_lib_0004
# Apply recipe with Drush (requires version 13 or later):
drush recipe ../recipes/{{ rawid }}
# Apply recipe without Drush:
cd web && php core/scripts/drupal recipe ../recipes/eca_lib_0004
# Rebuilding caches is optional, sometimes required:
drush cr
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2024-06-06