| 1 |
<?php |
| 2 |
/** |
| 3 |
* Iterator Actions |
| 4 |
* |
| 5 |
* Acts as a marker for the workflow engine to loop over an array in trigger_data. |
| 6 |
* The actual loop logic is handled in Workflow_Runner. |
| 7 |
* |
| 8 |
* @package WPbot_Automator |
| 9 |
*/ |
| 10 |
|
| 11 |
namespace WPbot_Automator\Actions; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Class Iterator_Actions |
| 19 |
*/ |
| 20 |
class Iterator_Actions extends Action { |
| 21 |
|
| 22 |
/** |
| 23 |
* Constructor |
| 24 |
*/ |
| 25 |
public function __construct() { |
| 26 |
$this->id = 'iterator'; |
| 27 |
$this->group = __( 'Flow Control', 'wpbot-automator' ); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Execute the action. |
| 32 |
* The Iterator itself is a no-op — the engine handles the looping. |
| 33 |
* |
| 34 |
* @param array $action_data Configuration for this action from the workflow. |
| 35 |
* @param array $trigger_data Data passed from the trigger. |
| 36 |
* @return array |
| 37 |
*/ |
| 38 |
public function execute( $action_data, $trigger_data ) { |
| 39 |
// This is handled directly in Workflow_Runner. Just mark success. |
| 40 |
return array( 'success' => true, 'message' => 'Iterator started.' ); |
| 41 |
} |
| 42 |
} |
| 43 |
|