PluginProbe
YayMail – WooCommerce Email Customizer / 4.3.2
YayMail – WooCommerce Email Customizer v4.3.2
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 / RatingStars.php

RatingStars.php in YayMail – WooCommerce Email Customizer 4.3.2, at src/Elements/RatingStars.php

139 lines 7.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\Utils\SingletonTrait;
6 /**
7 * RatingStars Elements
8 */
9 class RatingStars extends BaseElement {
10
11 use SingletonTrait;
12
13 protected static $type = 'rating_stars';
14
15 public $available_email_ids = [ YAYMAIL_ALL_EMAILS ];
16
17 public static function get_data( $attributes = [] ) {
18 self::$icon = '<svg width="21" height="18" viewBox="0 0 21 18" fill="none" xmlns="http://www.w3.org/2000/svg">
19 <g clip-path="url(#clip0_1493_40017)">
20 <path d="M17 -0.199951H3.99995C1.89995 -0.199951 0.199951 1.50005 0.199951 3.60005V10.8C0.199951 12.9 1.89995 14.6 3.99995 14.6H5.19995V16.7001C5.19995 17.0001 5.29995 17.2 5.59995 17.3C5.69995 17.4 5.79995 17.4 5.99995 17.4C6.09995 17.4 6.29995 17.4 6.39995 17.3L11.2 14.6H17C19.1 14.6 20.7999 12.9 20.7999 10.8V3.50005C20.7999 1.40005 19.1 -0.199951 17 -0.199951ZM19.2 10.7C19.2 11.9 18.2 12.9 17 12.9H11.3C11 12.9 10.7 13 10.4 13.1L6.69995 15.2V13.7C6.69995 13.3 6.39995 12.9 5.89995 12.9H3.99995C2.79995 12.9 1.79995 11.9 1.79995 10.7V3.50005C1.79995 2.30005 2.79995 1.30005 3.99995 1.30005H17C18.2 1.30005 19.2 2.30005 19.2 3.50005V10.7Z"/>
21 <path d="M9.1999 6.20005L7.8999 5.90005C7.7999 5.90005 7.6999 5.80005 7.6999 5.70005L6.9999 4.70005C6.8999 4.50005 6.4999 4.50005 6.3999 4.70005L5.7999 5.70005C5.7999 5.80005 5.6999 5.80005 5.5999 5.90005L4.2999 6.20005C3.9999 6.30005 3.8999 6.50005 4.0999 6.70005L4.9999 7.60005C4.9999 7.70005 5.0999 7.80005 4.9999 7.90005L4.8999 9.10005C4.8999 9.30005 5.0999 9.50005 5.3999 9.40005L6.5999 9.00005H6.8999L8.0999 9.50005C8.2999 9.60005 8.5999 9.40005 8.5999 9.20005L8.4999 8.00005C8.4999 7.90005 8.4999 7.80005 8.5999 7.80005L9.4999 6.90005C9.5999 6.50005 9.4999 6.20005 9.1999 6.20005Z"/>
22 <path d="M14.4999 7.90002H11.4999C11.1999 7.90002 10.8999 8.20002 10.8999 8.50002C10.8999 8.80002 11.1999 9.10003 11.4999 9.10003H14.4999C14.7999 9.10003 15.0999 8.80002 15.0999 8.50002C15.0999 8.20002 14.7999 7.90002 14.4999 7.90002Z"/>
23 <path d="M16.4999 5.40002H11.4999C11.1999 5.40002 10.8999 5.70002 10.8999 6.00002C10.8999 6.30002 11.1999 6.60003 11.4999 6.60003H16.4999C16.7999 6.60003 17.0999 6.30002 17.0999 6.00002C17.0999 5.70002 16.7999 5.40002 16.4999 5.40002Z"/>
24 </g>
25 <defs>
26 <clipPath id="clip0_1493_40017">
27 <rect width="21" height="18" fill="white"/>
28 </clipPath>
29 </defs>
30 </svg>
31 ';
32
33 return [
34 'id' => uniqid(),
35 'type' => self::$type,
36 'name' => __( 'Rating Stars', 'yaymail' ),
37 'icon' => self::$icon,
38 'group' => 'basic',
39 'available' => true,
40 'position' => 151,
41 'status_info' => [
42 'text' => __( 'New', 'yaymail' ),
43 ],
44 'data' => [
45 'container_group_definition' => [
46 'component' => 'GroupDefinition',
47 'title' => __( 'Container settings', 'yaymail' ),
48 'description' => __( 'Handle container layout settings', 'yaymail' ),
49 ],
50 'padding' => [
51 'value_path' => 'padding',
52 'component' => 'Spacing',
53 'title' => __( 'Padding', 'yaymail' ),
54 'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
55 'top' => '15',
56 'right' => '15',
57 'bottom' => '15',
58 'left' => '15',
59 ],
60 'type' => 'style',
61 ],
62 'background_color' => ElementsHelper::get_color(
63 $attributes,
64 [
65 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
66 ]
67 ),
68 'align' => ElementsHelper::get_align( $attributes ),
69 'content_breaker' => [
70 'component' => 'LineBreaker',
71 ],
72 'content_group_definition' => [
73 'component' => 'GroupDefinition',
74 'title' => __( 'Content settings', 'yaymail' ),
75 'description' => __( 'Handle content settings', 'yaymail' ),
76 ],
77 'total_stars' => [
78 'value_path' => 'total_stars',
79 'component' => 'NumberInput',
80 'title' => __( 'Total stars', 'yaymail' ),
81 'default_value' => isset( $attributes['total_stars'] ) ? $attributes['total_stars'] : '5',
82 'min' => 1,
83 'max' => 10,
84 'type' => 'style',
85 ],
86 'active_stars' => [
87 'value_path' => 'active_stars',
88 'component' => 'NumberInput',
89 'title' => __( 'Active stars', 'yaymail' ),
90 'default_value' => isset( $attributes['active_stars'] ) ? $attributes['active_stars'] : '5',
91 'min' => 0,
92 'max' => 10,
93 'max_dependency' => 'total_stars',
94 'type' => 'style',
95 ],
96 'active_stars_color' => ElementsHelper::get_color(
97 $attributes,
98 [
99 'title' => __( 'Active color', 'yaymail' ),
100 'description' => __( 'The color of the active stars', 'yaymail' ),
101 'value_path' => 'active_stars_color',
102 'default_value' => isset( $attributes['active_stars_color'] ) ? $attributes['active_stars_color'] : '#FFD700',
103 ]
104 ),
105 'inactive_stars_color' => ElementsHelper::get_color(
106 $attributes,
107 [
108 'title' => __( 'Inactive color', 'yaymail' ),
109 'description' => __( 'The color of the inactive stars', 'yaymail' ),
110 'value_path' => 'inactive_stars_color',
111 'default_value' => isset( $attributes['inactive_stars_color'] ) ? $attributes['inactive_stars_color'] : '#E0E0E0',
112 ]
113 ),
114 'size' => ElementsHelper::get_dimension(
115 $attributes,
116 [
117 'value_path' => 'size',
118 'title' => __( 'Size', 'yaymail' ),
119 'default_value' => isset( $attributes['size'] ) ? $attributes['size'] : '40',
120 'min' => 10,
121 'max' => 100,
122 ]
123 ),
124 'spacing' => ElementsHelper::get_dimension(
125 $attributes,
126 [
127 'value_path' => 'spacing',
128 'title' => __( 'Spacing', 'yaymail' ),
129 'default_value' => isset( $attributes['spacing'] ) ? $attributes['spacing'] : '10',
130 'min' => 10,
131 'max' => 25,
132 'type' => 'style',
133 ]
134 ),
135 ],
136 ];
137 }
138 }
139