/var/www/html_fr/wp-content/plugins/yaymail/src/Elements/OrderDetailsDownload.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
namespace YayMail\Elements;

use 
YayMail\Abstracts\BaseElement;
use 
YayMail\Utils\SingletonTrait;
use 
YayMail\Emails\CustomerCompletedOrder;

/**
 * OrderDetailsDownload Elements
 */
class OrderDetailsDownload extends BaseElement {

    use 
SingletonTrait;

    protected static 
$type 'order_details_download';

    protected function 
__construct() {
        
$this->available_email_ids CustomerCompletedOrder::get_instance()->get_id();
    }

    public static function 
get_data$attributes = [] ) {
        
$is_email_improvements_enabled get_option'woocommerce_feature_email_improvements_enabled''no' ) === 'yes';
        
$layout_type                   $is_email_improvements_enabled 'modern' 'legacy';

        
self::$icon '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 20 20">
  <path d="M17.5,2.5v15H2.5V2.5h15M18,1H2c-.55,0-1,.45-1,1v16c0,.55.45,1,1,1h16c.55,0,1-.45,1-1V2c0-.55-.45-1-1-1h0Z"/>
  <path d="M18.05,8.1H1.82c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h16.23c.41,0,.75.34.75.75s-.34.75-.75.75Z"/>
  <path d="M18.05,13.55H1.82c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h16.23c.41,0,.75.34.75.75s-.34.75-.75.75Z"/>
  <path d="M18.05,18.99H1.82c-.41,0-.75-.34-.75-.75s.34-.75.75-.75h16.23c.41,0,.75.34.75.75s-.34.75-.75.75Z"/>
  <path d="M12.75,18.8c-.41,0-.75-.34-.75-.75V1.82c0-.41.34-.75.75-.75s.75.34.75.75v16.23c0,.41-.34.75-.75.75Z"/>
  <path d="M7.27,18.8c-.41,0-.75-.34-.75-.75V1.82c0-.41.34-.75.75-.75s.75.34.75.75v16.23c0,.41-.34.75-.75.75Z"/>
</svg>'
;

        return [
            
'id'        => uniqid(),
            
'type'      => self::$type,
            
'name'      => __'Order Details Download''yaymail' ),
            
'icon'      => self::$icon,
            
'group'     => 'woocommerce',
            
'available' => true,
            
'position'  => 200,
            
'data'      => [
                
'layout_type'      => [
                    
'value_path'    => 'layout_type',
                    
'component'     => 'Selector',
                    
'title'         => __'Layout type''yaymail' ),
                    
'default_value' => isset( $attributes['layout_type'] ) ? $attributes['layout_type'] : $layout_type,
                    
'extras_data'   => [
                        
'options' => [
                            [
                                
'label' => __'Legacy''yaymail' ),
                                
'value' => 'legacy',
                            ],
                            [
                                
'label' => __'Modern''yaymail' ),
                                
'value' => 'modern',
                            ],
                        ],
                    ],
                    
'type'          => 'content',
                ],
                
'padding'          => [
                    
'value_path'    => 'padding',
                    
'component'     => 'Spacing',
                    
'title'         => __'Padding''yaymail' ),
                    
'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
                        
'top'    => '15',
                        
'right'  => '50',
                        
'bottom' => '15',
                        
'left'   => '50',
                    ],
                    
'type'          => 'style',
                ],
                
'background_color' => [
                    
'value_path'    => 'background_color',
                    
'component'     => 'Color',
                    
'title'         => __'Background color''yaymail' ),
                    
'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
                    
'type'          => 'style',
                ],
                
'title_color'      => [
                    
'value_path'    => 'title_color',
                    
'component'     => 'Color',
                    
'title'         => __'Title color''yaymail' ),
                    
'default_value' => isset( $attributes['title_color'] ) ? $attributes['title_color'] : YAYMAIL_COLOR_WC_DEFAULT,
                    
'type'          => 'style',
                ],
                
'text_color'       => [
                    
'value_path'    => 'text_color',
                    
'component'     => 'Color',
                    
'title'         => __'Text color''yaymail' ),
                    
'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : YAYMAIL_COLOR_TEXT_DEFAULT,
                    
'type'          => 'style',
                ],
                
'border_color'     => [
                    
'value_path'    => 'border_color',
                    
'component'     => 'Color',
                    
'title'         => __'Border color''yaymail' ),
                    
'default_value' => isset( $attributes['border_color'] ) ? $attributes['border_color'] : YAYMAIL_COLOR_BORDER_DEFAULT,
                    
'type'          => 'style',
                ],
                
'font_family'      => [
                    
'value_path'    => 'font_family',
                    
'component'     => 'FontFamilySelector',
                    
'title'         => __'Font family''yaymail' ),
                    
'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : YAYMAIL_DEFAULT_FAMILY,
                    
'type'          => 'style',
                ],
                
'rich_text'        => [
                    
'value_path'    => 'rich_text',
                    
'component'     => '',
                    
'title'         => __'Content''yaymail' ),
                    
'default_value' => isset( $attributes['rich_text'] ) ? $attributes['rich_text'] : '[yaymail_order_details_download_product]',
                    
'type'          => 'content',
                ],
                
'title'            => [
                    
'value_path'    => 'title',
                    
'component'     => 'RichTextEditor',
                    
'title'         => __'Header title''yaymail' ),
                    
'default_value' => isset( $attributes['title'] ) ? $attributes['title'] : '<span style="font-size: 20px;font-weight:600;">Downloads</span>',
                    
'type'          => 'content',
                ],
                
'product_title'    => [
                    
'value_path'    => 'product_title',
                    
'component'     => 'TextInput',
                    
'title'         => __'Product title''yaymail' ),
                    
'default_value' => esc_html__'Product''woocommerce' ),
                    
'type'          => 'content',
                ],
                
'expires_title'    => [
                    
'value_path'    => 'expires_title',
                    
'component'     => 'TextInput',
                    
'title'         => __'Expires title''yaymail' ),
                    
'default_value' => esc_html__'Expires''woocommerce' ),
                    
'type'          => 'content',
                ],
                
'download_title'   => [
                    
'value_path'    => 'download_title',
                    
'component'     => 'TextInput',
                    
'title'         => __'Download title''yaymail' ),
                    
'default_value' => esc_html__'Download''woocommerce' ),
                    
'type'          => 'content',
                ],
            ],
        ];
    }
}