/var/www/html_uk/wp-content/plugins/automatewoo/includes/Actions/Change_Workflow_Status.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
// phpcs:ignoreFile

namespace AutomateWoo;

if ( ! 
defined'ABSPATH' ) ) exit;

/**
 * @class Action_Change_Workflow_Status
 */
class Action_Change_Workflow_Status extends Action {

    public 
$required_data_items = [ 'workflow' ];


    function 
load_admin_details() {
        
$this->title __'Change Workflow Status''automatewoo');
        
$this->group __'AutomateWoo''automatewoo');
    }


    function 
load_fields() {
        
$status = ( new Fields\Selectfalse ) )
            ->
set_name('status')
            ->
set_title(__('Status''automatewoo'))
            ->
set_options([
                
'publish' => __'Active''automatewoo' ),
                
'aw-disabled' => __'Disabled''automatewoo' )
            ])
            ->
set_required();

        
$this->add_field($status);
    }


    function 
run() {
        
$workflow $this->workflow->data_layer()->get_workflow();
        
$status $this->get_option'status' );

        if ( ! 
$status || ! $workflow ) {
            return;
        }

        
$workflow->update_status$status );
    }
}