/var/www/html_it/wp-content/plugins/yaymail/src/Elements/Button.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
namespace YayMail\Elements;

use 
YayMail\Abstracts\BaseElement;
use 
YayMail\Utils\SingletonTrait;
use 
YayMail\Constants\AttributesData;
/**
 * Button Elements
 */
class Button extends BaseElement {

    use 
SingletonTrait;

    protected static 
$type 'button';

    public 
$available_email_ids = [ YAYMAIL_ALL_EMAILS ];

    public static function 
get_data$attributes = [] ) {
        
self::$icon '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" version="1.1" viewBox="0 0 20 20">
  <path d="M10,1C5,1,1,5,1,10s4,9,9,9,9-4,9-9S15,1,10,1ZM10,17.5c-4.1,0-7.5-3.4-7.5-7.5s3.4-7.5,7.5-7.5,7.5,3.4,7.5,7.5-3.4,7.5-7.5,7.5Z"/>
  <path d="M12.8,9.2h-2.1v-2.1c0-.4-.3-.8-.8-.8s-.8.3-.8.8v2.1h-2.1c-.4,0-.8.3-.8.8s.3.8.8.8h2.1v2.1c0,.4.3.8.8.8s.8-.3.8-.8v-2.1h2.1c.4,0,.8-.3.8-.8s-.3-.8-.8-.8Z"/>
</svg>'
;

        return [
            
'id'        => uniqid(),
            
'type'      => self::$type,
            
'name'      => __'Button''yaymail' ),
            
'icon'      => self::$icon,
            
'group'     => 'basic',
            
'available' => true,
            
'position'  => 60,
            
'data'      => [
                
'container_group_definition'      => [
                    
'component'   => 'GroupDefinition',
                    
'title'       => __'Container settings''yaymail' ),
                    
'description' => __'Handle container layout settings''yaymail' ),
                ],
                
'padding'                         => ElementsHelper::get_spacing(
                    
$attributes,
                    [
                        
'title' => __'Padding''yaymail' ),
                    ]
                ),
                
'background_color'                => ElementsHelper::get_color(
                    
$attributes,
                    [
                        
'default_value' => '#fff',
                    ]
                ),
                
'button_setting_breaker'          => [
                    
'component' => 'LineBreaker',
                ],
                
'button_group_definition'         => [
                    
'component'   => 'GroupDefinition',
                    
'title'       => __'Button settings''yaymail' ),
                    
'description' => __'Handle button settings''yaymail' ),
                ],
                
'button_type'                     => ElementsHelper::get_button_type_selector$attributes ),
                
'align'                           => ElementsHelper::get_align(
                    
$attributes,
                    [
                        
'title' => __'Button position''yaymail' ),
                    ]
                ),
                
'width'                           => ElementsHelper::get_dimension(
                    
$attributes,
                    [
                        
'default_value' => '50',
                        
'min'           => 0,
                        
'max'           => 100,
                        
'unit'          => '%',
                    ]
                ),
                
'height'                          => ElementsHelper::get_dimension(
                    
$attributes,
                    [
                        
'value_path'    => 'height',
                        
'title'         => __'Height''yaymail' ),
                        
'default_value' => '21',
                        
'min'           => 0,
                        
'max'           => 100,
                    ]
                ),
                
'button_padding'                  => [
                    
'value_path'    => 'button_padding',
                    
'component'     => 'Spacing',
                    
'title'         => __'Padding''yaymail' ),
                    
'default_value' => [
                        
'top'    => '12',
                        
'right'  => '20',
                        
'bottom' => '12',
                        
'left'   => '20',
                    ],
                    
'type'          => 'style',
                ],
                
'button_background_color'         => ElementsHelper::get_color(
                    
$attributes,
                    [
                        
'value_path'    => 'button_background_color',
                        
'title'         => __'Background color''yaymail' ),
                        
'default_value' => YAYMAIL_COLOR_WC_DEFAULT,
                    ]
                ),
                
'text_color'                      => ElementsHelper::get_color(
                    
$attributes,
                    [
                        
'value_path'    => 'text_color',
                        
'title'         => __'Text color''yaymail' ),
                        
'default_value' => '#ffffff',
                    ]
                ),
                
'border'                          => [
                    
'value_path'    => 'border',
                    
'component'     => 'Border',
                    
'title'         => __'Border''yaymail' ),
                    
'default_value' => isset( $attributes['border'] ) ? $attributes['border'] : AttributesData::BORDER_DEFAULT,
                    
'type'          => 'style',
                ],
                
'border_radius'                   => ElementsHelper::get_border_radius(
                    
$attributes,
                    [
                        
'value_path'    => 'border_radius',
                        
'title'         => __'Border radius''yaymail' ),
                        
'default_value' => [
                            
'top_left'     => '5',
                            
'top_right'    => '5',
                            
'bottom_right' => '5',
                            
'bottom_left'  => '5',
                        ],
                    ]
                ),
                
'button_content_group_definition' => [
                    
'component'   => 'GroupDefinition',
                    
'title'       => __'Button content''yaymail' ),
                    
'description' => __'Handle button content''yaymail' ),
                ],
                
'text'                            => ElementsHelper::get_text_input(
                    
$attributes,
                    [
                        
'value_path'    => 'text',
                        
'title'         => __'Button text''yaymail' ),
                        
'default_value' => __'Click me''yaymail' ),
                    ]
                ),
                
'url'                             => ElementsHelper::get_text_input$attributes ),
                
'font_size'                       => ElementsHelper::get_dimension(
                    
$attributes,
                    [
                        
'value_path'    => 'font_size',
                        
'title'         => __'Font size''yaymail' ),
                        
'default_value' => '13',
                        
'min'           => 10,
                        
'max'           => 40,
                    ]
                ),
                
'weight'                          => ElementsHelper::get_font_weight_selector$attributes ),
                
'font_family'                     => ElementsHelper::get_font_family_selector$attributes ),
            ],
        ];
    }
}