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 / Title.php

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

124 lines 6.1 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 * Title Elements
8 */
9 class Title extends BaseElement {
10
11 use SingletonTrait;
12
13 protected static $type = 'title';
14
15 public $available_email_ids = [ YAYMAIL_ALL_EMAILS ];
16
17 public static function get_data( $attributes = [] ) {
18 self::$icon = '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 20 20">
19 <path d="M18.82,17.17H1.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-.13ZM4.19,15.04h1.91c.09,0,.18-.06.21-.15l1.21-3.73h4.93l1.2,3.73c.03.09.11.15.21.15h2s.05,0,.07-.01c.03,0,.05-.02.07-.04.02-.02.04-.04.05-.07.01-.03.02-.05.02-.08,0-.03,0-.06-.01-.08L11.39,1.15s-.04-.08-.08-.11c-.04-.03-.08-.04-.13-.04h-2.3c-.09,0-.18.06-.21.15L3.98,14.75s-.01.05-.01.07c0,.12.1.22.22.22ZM9.95,3.43h.09l1.89,5.94h-3.88l1.91-5.94Z"/>
20 </svg>';
21
22 return [
23 'id' => uniqid(),
24 'type' => self::$type,
25 'name' => __( 'Title', 'yaymail' ),
26 'icon' => self::$icon,
27 'group' => 'basic',
28 'available' => true,
29 'position' => 80,
30 'data' => [
31 'container_group_definition' => [
32 'component' => 'GroupDefinition',
33 'title' => __( 'Container settings', 'yaymail' ),
34 'description' => __( 'Handle container layout settings', 'yaymail' ),
35 ],
36 'padding' => [
37 'value_path' => 'padding',
38 'component' => 'Spacing',
39 'title' => __( 'Padding', 'yaymail' ),
40 'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
41 'top' => '15',
42 'right' => '50',
43 'bottom' => '15',
44 'left' => '50',
45 ],
46 'type' => 'style',
47 ],
48 'background_color' => [
49 'value_path' => 'background_color',
50 'component' => 'Color',
51 'title' => __( 'Background color', 'yaymail' ),
52 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
53 'type' => 'style',
54 ],
55 'text_color' => [
56 'value_path' => 'text_color',
57 'component' => 'Color',
58 'title' => __( 'Text color', 'yaymail' ),
59 'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : '#444444',
60 'type' => 'style',
61 ],
62 'font_family' => [
63 'value_path' => 'font_family',
64 'component' => 'FontFamilySelector',
65 'title' => __( 'Font family', 'yaymail' ),
66 'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : YAYMAIL_DEFAULT_FAMILY,
67 'type' => 'style',
68 ],
69 'align' => [
70 'value_path' => 'align',
71 'component' => 'Align',
72 'title' => __( 'Text align', 'yaymail' ),
73 'default_value' => isset( $attributes['align'] ) ? $attributes['align'] : 'center',
74 'type' => 'style',
75 ],
76 'title_breaker' => [
77 'component' => 'LineBreaker',
78 ],
79 'title_group_definition' => [
80 'component' => 'GroupDefinition',
81 'title' => __( 'Title settings', 'yaymail' ),
82 'description' => __( 'Handle title settings', 'yaymail' ),
83 ],
84 'title' => [
85 'value_path' => 'title',
86 'component' => 'TextInput',
87 'title' => __( 'Text', 'yaymail' ),
88 'default_value' => isset( $attributes['title'] ) ? $attributes['title'] : __( 'Enter your title here', 'yaymail' ),
89 'type' => 'content',
90 ],
91 'title_size' => [
92 'value_path' => 'title_size',
93 'component' => 'FontSizeSelector',
94 'title' => __( 'Font size', 'yaymail' ),
95 'default_value' => isset( $attributes['title_size'] ) ? $attributes['title_size'] : 'default',
96 'type' => 'style',
97 ],
98 'subtitle_breaker' => [
99 'component' => 'LineBreaker',
100 ],
101 'subtitle_group_definition' => [
102 'component' => 'GroupDefinition',
103 'title' => __( 'Subtitle settings', 'yaymail' ),
104 'description' => __( 'Handle subtitle settings', 'yaymail' ),
105 ],
106 'subtitle' => [
107 'value_path' => 'subtitle',
108 'component' => 'TextInput',
109 'title' => __( 'Text', 'yaymail' ),
110 'default_value' => isset( $attributes['subtitle'] ) ? $attributes['subtitle'] : __( 'Subtitle', 'yaymail' ),
111 'type' => 'content',
112 ],
113 'subtitle_size' => [
114 'value_path' => 'subtitle_size',
115 'component' => 'FontSizeSelector',
116 'title' => __( 'Font size', 'yaymail' ),
117 'default_value' => isset( $attributes['subtitle_size'] ) ? $attributes['subtitle_size'] : 'default',
118 'type' => 'style',
119 ],
120 ],
121 ];
122 }
123 }
124