PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.0
YayMail – WooCommerce Email Customizer v4.4.0
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 / ImageBox.php

ImageBox.php in YayMail – WooCommerce Email Customizer 4.4.0, at src/Elements/ImageBox.php

125 lines 6.0 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 * ImageBox Elements
8 */
9 class ImageBox extends BaseElement {
10
11 use SingletonTrait;
12
13 protected static $type = 'image_box';
14
15 public $available_email_ids = [ YAYMAIL_ALL_EMAILS ];
16
17 public static function get_data( $attributes = [] ) {
18 $src = esc_url( YAYMAIL_PLUGIN_URL . 'assets/images/default-photo.png' );
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.31,2.5H1.69c-.38,0-.69-.34-.69-.75s.31-.75.69-.75h16.62c.38,0,.69.34.69.75s-.31.75-.69.75Z"/>
21 <path d="M18.31,7.75h-6.9c-.38,0-.69-.34-.69-.75s.31-.75.69-.75h6.9c.38,0,.69.34.69.75s-.31.75-.69.75Z"/>
22 <path d="M18.31,13.75h-6.9c-.38,0-.69-.34-.69-.75s.31-.75.69-.75h6.9c.38,0,.69.34.69.75s-.31.75-.69.75Z"/>
23 <path d="M18.31,19H1.69c-.38,0-.69-.34-.69-.75s.31-.75.69-.75h16.62c.38,0,.69.34.69.75s-.31.75-.69.75Z"/>
24 <path d="M8.43,13.66H1l-.04-.79v-6.63l.79-.04h7.44l.04.79v6.63l-.79.04ZM2.46,12.16h5.27v-4.46H2.46v4.46Z"/>
25 </svg>';
26
27 return [
28 'id' => uniqid(),
29 'type' => self::$type,
30 'name' => __( 'Image Box', 'yaymail' ),
31 'icon' => self::$icon,
32 'group' => 'basic',
33 'available' => true,
34 'position' => 120,
35 'data' => [
36 'container_group_definition' => [
37 'component' => 'GroupDefinition',
38 'title' => __( 'Container settings', 'yaymail' ),
39 'description' => __( 'Handle container layout settings', 'yaymail' ),
40 ],
41 'background_color' => [
42 'value_path' => 'background_color',
43 'component' => 'Color',
44 'title' => __( 'Background color', 'yaymail' ),
45 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
46 'type' => 'style',
47 ],
48 'text_color' => [
49 'value_path' => 'text_color',
50 'component' => 'Color',
51 'title' => __( 'Text color', 'yaymail' ),
52 'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : YAYMAIL_COLOR_TEXT_DEFAULT,
53 'type' => 'style',
54 ],
55 'column_breaker' => [
56 'component' => 'LineBreaker',
57 ],
58 'column_settings' => [
59 'component' => 'GroupDefinition',
60 'title' => __( 'Column settings', 'yaymail' ),
61 'description' => __( 'Handle column settings', 'yaymail' ),
62 ],
63 'image_box' => [
64 'component' => 'ImageBox',
65 'value_path' => 'image_box',
66 'column_1' => [
67 'padding' => [
68 'value' => $attributes['column_1']['padding'] ?? [
69 'top' => '10',
70 'right' => '10',
71 'bottom' => '10',
72 'left' => '50',
73 ],
74 'type' => 'style',
75 ],
76 'align' => [
77 'value' => $attributes['column_1']['align'] ?? 'center',
78 'type' => 'style',
79 ],
80 'image' => [
81 'value' => $attributes['column_1']['image'] ?? $src,
82 'type' => 'content',
83 ],
84 'full_width' => [
85 'value' => $attributes['column_1']['full_width'] ?? false,
86 'type' => 'style',
87 ],
88 'width' => [
89 'value' => $attributes['column_1']['width'] ?? '242',
90 'type' => 'style',
91 ],
92 'url' => [
93 'value' => $attributes['column_1']['url'] ?? '#',
94 'type' => 'content',
95 ],
96 'alt' => [
97 'value' => $attributes['column_1']['alt'] ?? '',
98 'type' => 'content',
99 ],
100 ],
101 'column_2' => [
102 'padding' => [
103 'value' => $attributes['column_2']['padding'] ?? [
104 'top' => '10',
105 'right' => '50',
106 'bottom' => '10',
107 'left' => '10',
108 ],
109 'type' => 'style',
110 ],
111 'font_family' => [
112 'value' => $attributes['column_2']['font_family'] ?? YAYMAIL_DEFAULT_FAMILY,
113 'type' => 'style',
114 ],
115 'rich_text' => [
116 'value' => $attributes['column_2']['rich_text'] ?? '<p><span style="font-size: 18px;"><strong>This is a title</strong></span></p><p><span> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy.</span></p><p><span>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</span></p>',
117 'type' => 'content',
118 ],
119 ],
120 ],
121 ],
122 ];
123 }
124 }
125