/var/www/html_uk/wp-content/plugins/automatewoo/includes/Actions/Active_Campaign_Abstract.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php

namespace AutomateWoo;

use 
AutomateWoo\Traits\TagField;

defined'ABSPATH' ) || exit;

/**
 * @class Action_Active_Campaign_Abstract
 */
abstract class Action_Active_Campaign_Abstract extends Action {
    use 
TagField;

    
/** @var Integration_ActiveCampaign ActiveCampaign Integration class */
    
private $activecampaign;

    
/**
     * Set admin details group value
     *
     * @return void
     */
    
public function load_admin_details() {
        
$this->group __'ActiveCampaign''automatewoo' );
    }

    
/**
     * Add contact email field to Action
     *
     * @return Fields\Text
     */
    
public function add_contact_email_field() {
        
$email = ( new Fields\Text() )
            ->
set_name'email' )
            ->
set_title__'Contact email''automatewoo' ) )
            ->
set_description__'You can use variables such as {{ customer.email }} here.''automatewoo' ) )
            ->
set_required()
            ->
set_variable_validation();

        
$this->add_field$email );

        return 
$email;
    }

    
/**
     * Add additional contact fields to Action
     *
     * @return void
     */
    
public function add_contact_fields() {
        
$first_name = ( new Fields\Text() )
            ->
set_name'first_name' )
            ->
set_title__'First name''automatewoo' ) )
            ->
set_variable_validation();

        
$last_name = ( new Fields\Text() )
            ->
set_name'last_name' )
            ->
set_title__'Last name''automatewoo' ) )
            ->
set_variable_validation();

        
$phone = ( new Fields\Text() )
            ->
set_name'phone' )
            ->
set_title__'Phone''automatewoo' ) )
            ->
set_variable_validation();

        
$company = ( new Fields\Text() )
            ->
set_name'company' )
            ->
set_title__'Organization''automatewoo' ) )
            ->
set_variable_validation();

        
$this->add_field$first_name );
        
$this->add_field$last_name );
        
$this->add_field$phone );
        
$this->add_field$company );
    }

    
/**
     * Add tags field to Action
     *
     * @return Fields\Text
     */
    
public function add_tags_field() {
        
$tag $this->get_tags_field()
                    ->
set_description__'Add multiple tags separated by commas. Please note that tags are not case-sensitive.''automatewoo' ) );

        
$this->add_field$tag );

        return 
$tag;
    }

    
/**
     * Get the ActiveCampaign integration
     *
     * @return Integration_ActiveCampaign
     */
    
public function activecampaign(): Integration_ActiveCampaign {
        if ( ! 
$this->activecampaign ) {
            
$this->activecampaign Integrations::activecampaign();
        }

        return 
$this->activecampaign;
    }
}