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

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

107 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 use YayMail\Utils\TemplateHelpers;
7 /**
8 * EmailHeading Elements
9 */
10 class Heading extends BaseElement {
11
12 use SingletonTrait;
13
14 protected static $type = 'heading';
15
16 public $available_email_ids = [ YAYMAIL_ALL_EMAILS ];
17
18 public static function get_data( $attributes = [] ) {
19
20 $style = TemplateHelpers::get_style(
21 [
22 'font-size' => '30px',
23 'font-weight' => '300',
24 'line-height' => 'normal',
25 'margin' => '0px',
26 'color' => 'inherit',
27 ]
28 );
29
30 if ( isset( $attributes['rich_text'] ) ) {
31 $content = '<h1 style="' . esc_attr( $style ) . '">' . $attributes['rich_text'] . '</h1>';
32 } else {
33 $content = __( 'Email Heading', 'yaymail' );
34 $content = '<h1 style="' . esc_attr( $style ) . '">' . $content . '</h1>';
35 }
36
37 self::$icon = '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 20 20">
38 <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"/>
39 </svg>';
40
41 return [
42 'id' => uniqid(),
43 'type' => self::$type,
44 'name' => __( 'Email Heading', 'yaymail' ),
45 'icon' => self::$icon,
46 'group' => 'basic',
47 'available' => true,
48 'position' => 20,
49 'data' => [
50 'container_group_definition' => [
51 'component' => 'GroupDefinition',
52 'title' => __( 'Container settings', 'yaymail' ),
53 'description' => __( 'Handle container layout settings', 'yaymail' ),
54 ],
55 'padding' => [
56 'value_path' => 'padding',
57 'component' => 'Spacing',
58 'title' => __( 'Padding', 'yaymail' ),
59 'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
60 'top' => '40',
61 'right' => '50',
62 'bottom' => '40',
63 'left' => '50',
64 ],
65 'type' => 'style',
66 ],
67 'background_color' => [
68 'value_path' => 'background_color',
69 'component' => 'Color',
70 'title' => __( 'Background color', 'yaymail' ),
71 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : YAYMAIL_COLOR_WC_DEFAULT,
72 'type' => 'style',
73 ],
74 'content_breaker' => [
75 'component' => 'LineBreaker',
76 ],
77 'content_group_definition' => [
78 'component' => 'GroupDefinition',
79 'title' => __( 'Content settings', 'yaymail' ),
80 'description' => __( 'Handle content settings', 'yaymail' ),
81 ],
82 'font_family' => [
83 'value_path' => 'font_family',
84 'component' => 'FontFamilySelector',
85 'title' => __( 'Font family', 'yaymail' ),
86 'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : YAYMAIL_DEFAULT_FAMILY,
87 'type' => 'style',
88 ],
89 'text_color' => [
90 'value_path' => 'text_color',
91 'component' => 'Color',
92 'title' => __( 'Text color', 'yaymail' ),
93 'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : '#ffffff',
94 'type' => 'style',
95 ],
96 'rich_text' => [
97 'value_path' => 'rich_text',
98 'component' => 'RichTextEditor',
99 'title' => __( 'Content', 'yaymail' ),
100 'default_value' => $content,
101 'type' => 'content',
102 ],
103 ],
104 ];
105 }
106 }
107