PluginProbe
YayMail – WooCommerce Email Customizer / trunk
YayMail – WooCommerce Email Customizer vtrunk
4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 3.4.2 3.4.3 All 55 releases
yaymail / src / Elements / Divider.php

Divider.php in YayMail – WooCommerce Email Customizer trunk, at src/Elements/Divider.php

113 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace YayMail\Elements;
3
4 use YayMail\Abstracts\BaseElement;
5 use YayMail\Utils\SingletonTrait;
6
7 /**
8 * Divider Elements
9 */
10 class Divider extends BaseElement {
11
12 use SingletonTrait;
13
14 protected static $type = 'divider';
15
16 public $available_email_ids = [ YAYMAIL_ALL_EMAILS ];
17
18 public static function get_data( $attributes = [] ) {
19 self::$icon = '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 20 20">
20 <path d="M18.82,9.25H1.18c-.1,0-.18.06-.18.13v1.25c0,.07.08.13.18.13h17.64c.1,0,.18-.06.18-.13v-1.25c0-.07-.08-.13-.18-.13Z"/>
21 </svg>';
22
23 return [
24 'id' => uniqid(),
25 'type' => self::$type,
26 'name' => __( 'Divider', 'yaymail' ),
27 'icon' => self::$icon,
28 'group' => 'general',
29 'available' => true,
30 'position' => 140,
31 'data' => [
32 'align' => [
33 'value_path' => 'align',
34 'component' => 'Align',
35 'title' => __( 'Align', 'yaymail' ),
36 'default_value' => isset( $attributes['align'] ) ? $attributes['align'] : 'center',
37 'type' => 'style',
38 ],
39 'padding' => [
40 'value_path' => 'padding',
41 'component' => 'Spacing',
42 'title' => __( 'Padding', 'yaymail' ),
43 'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
44 'top' => '15',
45 'right' => '50',
46 'bottom' => '15',
47 'left' => '50',
48 ],
49 'type' => 'style',
50 ],
51 'width' => [
52 'value_path' => 'width',
53 'component' => 'Dimension',
54 'title' => __( 'Width', 'yaymail' ),
55 'default_value' => isset( $attributes['width'] ) ? $attributes['width'] : '100',
56 'min' => 0,
57 'max' => 100,
58 'unit' => '%',
59 'type' => 'style',
60 ],
61 'height' => [
62 'value_path' => 'height',
63 'component' => 'Dimension',
64 'title' => __( 'Height', 'yaymail' ),
65 'default_value' => isset( $attributes['height'] ) ? $attributes['height'] : '6',
66 'min' => 1,
67 'max' => 30,
68 'type' => 'style',
69 ],
70 'background_color' => [
71 'value_path' => 'background_color',
72 'component' => 'Color',
73 'title' => __( 'Background color', 'yaymail' ),
74 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
75 'type' => 'style',
76 ],
77 'divider_color' => [
78 'value_path' => 'divider_color',
79 'component' => 'Color',
80 'title' => __( 'Line color', 'yaymail' ),
81 'default_value' => isset( $attributes['divider_color'] ) ? $attributes['divider_color'] : '#333',
82 'type' => 'style',
83 ],
84 'divider_type' => [
85 'value_path' => 'divider_type',
86 'component' => 'DividerTypeSelector',
87 'title' => __( 'Line type', 'yaymail' ),
88 'default_value' => isset( $attributes['divider_type'] ) ? $attributes['divider_type'] : 'solid',
89 'options' => [
90 [
91 'label' => __( 'Solid', 'yaymail' ),
92 'value' => 'solid',
93 ],
94 [
95 'label' => __( 'Double', 'yaymail' ),
96 'value' => 'double',
97 ],
98 [
99 'label' => __( 'Dotted', 'yaymail' ),
100 'value' => 'dotted',
101 ],
102 [
103 'label' => __( 'Dashed', 'yaymail' ),
104 'value' => 'dashed',
105 ],
106 ],
107 'type' => 'style',
108 ],
109 ],
110 ];
111 }
112 }
113