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

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

99 lines 5.5 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\Constants\AttributesData;
6 use YayMail\Utils\SingletonTrait;
7
8 /**
9 * Text Elements
10 */
11 class Text extends BaseElement {
12
13 use SingletonTrait;
14
15 protected static $type = 'text';
16
17 public $available_email_ids = [ YAYMAIL_ALL_EMAILS ];
18
19 public static function get_data( $attributes = [] ) {
20 $default_content = '<p><span style="font-size: 18px;"><strong>This is a title</strong></span></p><p>&nbsp;</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>&nbsp;</p><p><span>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</span></p><p>&nbsp;</p><p><span>Various versions have evolved over the years.</span></p>';
21 self::$icon = '<svg viewBox="64 64 896 896" data-icon="form" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M904 512h-56c-4.4 0-8 3.6-8 8v320H184V184h320c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V520c0-4.4-3.6-8-8-8z"></path><path d="M355.9 534.9L354 653.8c-.1 8.9 7.1 16.2 16 16.2h.4l118-2.9c2-.1 4-.9 5.4-2.3l415.9-415c3.1-3.1 3.1-8.2 0-11.3L785.4 114.3c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-415.8 415a8.3 8.3 0 0 0-2.3 5.6zm63.5 23.6L779.7 199l45.2 45.1-360.5 359.7-45.7 1.1.7-46.4z"></path></svg>';
22
23 return parent::merge_common_data(
24 [
25 'id' => uniqid(),
26 'type' => self::$type,
27 'name' => __( 'Text', 'yaymail' ),
28 'icon' => self::$icon,
29 'group' => 'basic',
30 'available' => true,
31 'position' => 70,
32 'data' => [
33 'container_group_definition' => [
34 'component' => 'GroupDefinition',
35 'title' => __( 'Container settings', 'yaymail' ),
36 'description' => __( 'Handle container layout settings', 'yaymail' ),
37 ],
38 'padding' => [
39 'value_path' => 'padding',
40 'component' => 'Spacing',
41 'title' => __( 'Padding', 'yaymail' ),
42 'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
43 'top' => '15',
44 'right' => '50',
45 'bottom' => '15',
46 'left' => '50',
47 ],
48 'type' => 'style',
49 ],
50 'background_color' => [
51 'value_path' => 'background_color',
52 'component' => 'Color',
53 'title' => __( 'Background color', 'yaymail' ),
54 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
55 'type' => 'style',
56 ],
57 'border' => [
58 'value_path' => 'border',
59 'component' => 'Border',
60 'title' => __( 'Border', 'yaymail' ),
61 'default_value' => isset( $attributes['border'] ) ? $attributes['border'] : AttributesData::BORDER_DEFAULT,
62 'type' => 'style',
63 ],
64 'content_breaker' => [
65 'component' => 'LineBreaker',
66 ],
67 'content_group_definition' => [
68 'component' => 'GroupDefinition',
69 'title' => __( 'Content settings', 'yaymail' ),
70 'description' => __( 'Handle content settings', 'yaymail' ),
71 ],
72 'font_family' => [
73 'value_path' => 'font_family',
74 'component' => 'FontFamilySelector',
75 'title' => __( 'Font family', 'yaymail' ),
76 'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : YAYMAIL_DEFAULT_FAMILY,
77 'type' => 'style',
78 ],
79 'text_color' => [
80 'value_path' => 'text_color',
81 'component' => 'Color',
82 'title' => __( 'Text color', 'yaymail' ),
83 'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : YAYMAIL_COLOR_TEXT_DEFAULT,
84 'type' => 'style',
85 ],
86 'rich_text' => [
87 'value_path' => 'rich_text',
88 'component' => 'RichTextEditor',
89 'title' => __( 'Content', 'yaymail' ),
90 'default_value' => isset( $attributes['rich_text'] ) ? $attributes['rich_text'] : $default_content,
91 'type' => 'content',
92 ],
93 ],
94 ],
95 $attributes
96 );
97 }
98 }
99