| 1 |
<?php |
| 2 |
namespace YayMail\Elements; |
| 3 |
|
| 4 |
use YayMail\Abstracts\BaseElement; |
| 5 |
use YayMail\Utils\SingletonTrait; |
| 6 |
/** |
| 7 |
* TextList Elements |
| 8 |
*/ |
| 9 |
class TextList extends BaseElement { |
| 10 |
|
| 11 |
use SingletonTrait; |
| 12 |
|
| 13 |
protected static $type = 'text_list'; |
| 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 |
<defs> |
| 20 |
<style> |
| 21 |
.cls-1 { |
| 22 |
fill: none; |
| 23 |
} |
| 24 |
</style> |
| 25 |
</defs> |
| 26 |
<rect class="cls-1" x="1" y="10.75" width="18" height="6.74"/> |
| 27 |
<rect class="cls-1" x="1" y="2.5" width="18" height="6.74"/> |
| 28 |
<rect x="1" y="9.25" width="18" height="1.5"/> |
| 29 |
<rect x="1" y="17.5" width="18" height="1.5"/> |
| 30 |
<rect x="1" y="1" width="18" height="1.5"/> |
| 31 |
</svg>'; |
| 32 |
|
| 33 |
return [ |
| 34 |
'id' => uniqid(), |
| 35 |
'type' => self::$type, |
| 36 |
'name' => __( 'Text List', 'yaymail' ), |
| 37 |
'icon' => self::$icon, |
| 38 |
'group' => 'basic', |
| 39 |
'available' => true, |
| 40 |
'position' => 130, |
| 41 |
'data' => [ |
| 42 |
'container_group_definition' => [ |
| 43 |
'component' => 'GroupDefinition', |
| 44 |
'title' => __( 'Container settings', 'yaymail' ), |
| 45 |
'description' => __( 'Handle container layout settings', 'yaymail' ), |
| 46 |
], |
| 47 |
'background_color' => [ |
| 48 |
'value_path' => 'background_color', |
| 49 |
'component' => 'Color', |
| 50 |
'title' => __( 'Background color', 'yaymail' ), |
| 51 |
'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff', |
| 52 |
'type' => 'style', |
| 53 |
], |
| 54 |
'text_color' => [ |
| 55 |
'value_path' => 'text_color', |
| 56 |
'component' => 'Color', |
| 57 |
'title' => __( 'Text color', 'yaymail' ), |
| 58 |
'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : YAYMAIL_COLOR_TEXT_DEFAULT, |
| 59 |
'type' => 'style', |
| 60 |
], |
| 61 |
'number_column' => [ |
| 62 |
'value_path' => 'number_column', |
| 63 |
'component' => 'NumberColumn', |
| 64 |
'title' => __( 'Number of columns:', 'yaymail' ), |
| 65 |
'default_value' => isset( $attributes['number_column'] ) ? $attributes['number_column'] : 2, |
| 66 |
'type' => 'content', |
| 67 |
], |
| 68 |
'column_breaker' => [ |
| 69 |
'component' => 'LineBreaker', |
| 70 |
], |
| 71 |
'column_settings' => [ |
| 72 |
'component' => 'GroupDefinition', |
| 73 |
'title' => __( 'Column settings', 'yaymail' ), |
| 74 |
'description' => __( 'Handle column settings', 'yaymail' ), |
| 75 |
], |
| 76 |
'text_list' => [ |
| 77 |
'component' => 'TextList', |
| 78 |
'value_path' => 'text_list', |
| 79 |
'column_1' => [ |
| 80 |
'padding' => [ |
| 81 |
'value' => isset( $attributes['column_1']['padding'] ) ? $attributes['column_1']['padding'] : [ |
| 82 |
'top' => '10', |
| 83 |
'right' => '10', |
| 84 |
'bottom' => '10', |
| 85 |
'left' => '50', |
| 86 |
], |
| 87 |
'type' => 'style', |
| 88 |
], |
| 89 |
|
| 90 |
'font_family' => [ |
| 91 |
'value' => isset( $attributes['column_1']['font_family'] ) ? $attributes['column_1']['font_family'] : YAYMAIL_DEFAULT_FAMILY, |
| 92 |
'type' => 'style', |
| 93 |
], |
| 94 |
|
| 95 |
'rich_text' => [ |
| 96 |
'value' => isset( $attributes['column_1']['rich_text'] ) ? $attributes['column_1']['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>', |
| 97 |
'type' => 'content', |
| 98 |
], |
| 99 |
|
| 100 |
'show_button' => [ |
| 101 |
'value' => isset( $attributes['column_1']['show_button'] ) ? $attributes['column_1']['show_button'] : true, |
| 102 |
'type' => 'content', |
| 103 |
], |
| 104 |
|
| 105 |
'button_type' => [ |
| 106 |
'value' => isset( $attributes['column_1']['button_type'] ) ? $attributes['column_1']['button_type'] : 'default', |
| 107 |
'type' => 'style', |
| 108 |
], |
| 109 |
|
| 110 |
'button_align' => [ |
| 111 |
'value' => isset( $attributes['column_1']['button_align'] ) ? $attributes['column_1']['button_align'] : 'center', |
| 112 |
'type' => 'style', |
| 113 |
], |
| 114 |
|
| 115 |
'button_padding' => [ |
| 116 |
'value' => isset( $attributes['column_1']['button_padding'] ) ? $attributes['column_1']['button_padding'] : [ |
| 117 |
'top' => '0', |
| 118 |
'right' => '0', |
| 119 |
'bottom' => '0', |
| 120 |
'left' => '50', |
| 121 |
], |
| 122 |
'type' => 'style', |
| 123 |
], |
| 124 |
|
| 125 |
'button_border_radius' => [ |
| 126 |
'value' => isset( $attributes['column_1']['button_border_radius'] ) ? $attributes['column_1']['button_border_radius'] : [ |
| 127 |
'top_left' => '5', |
| 128 |
'top_right' => '5', |
| 129 |
'bottom_right' => '5', |
| 130 |
'bottom_left' => '5', |
| 131 |
], |
| 132 |
'type' => 'style', |
| 133 |
], |
| 134 |
|
| 135 |
'button_text' => [ |
| 136 |
'value' => isset( $attributes['column_1']['button_text'] ) ? $attributes['column_1']['button_text'] : __( 'Click me', 'yaymail' ), |
| 137 |
'type' => 'content', |
| 138 |
], |
| 139 |
|
| 140 |
'button_url' => [ |
| 141 |
'value' => isset( $attributes['column_1']['button_url'] ) ? $attributes['column_1']['button_url'] : '#', |
| 142 |
'type' => 'content', |
| 143 |
], |
| 144 |
|
| 145 |
'button_background_color' => [ |
| 146 |
'value' => isset( $attributes['column_1']['button_background_color'] ) ? $attributes['column_1']['button_background_color'] : YAYMAIL_COLOR_WC_DEFAULT, |
| 147 |
'type' => 'style', |
| 148 |
], |
| 149 |
|
| 150 |
'button_text_color' => [ |
| 151 |
'value' => isset( $attributes['column_1']['button_text_color'] ) ? $attributes['column_1']['button_text_color'] : '#ffffff', |
| 152 |
'type' => 'style', |
| 153 |
], |
| 154 |
|
| 155 |
'button_font_size' => [ |
| 156 |
'value' => isset( $attributes['column_1']['button_font_size'] ) ? $attributes['column_1']['button_font_size'] : '13', |
| 157 |
'type' => 'style', |
| 158 |
], |
| 159 |
|
| 160 |
'button_height' => [ |
| 161 |
'value' => isset( $attributes['column_1']['button_height'] ) ? $attributes['column_1']['button_height'] : '21', |
| 162 |
'type' => 'style', |
| 163 |
], |
| 164 |
|
| 165 |
'button_width' => [ |
| 166 |
'value' => isset( $attributes['column_1']['button_width'] ) ? $attributes['column_1']['button_width'] : '50', |
| 167 |
'type' => 'style', |
| 168 |
], |
| 169 |
|
| 170 |
'button_weight' => [ |
| 171 |
'value' => isset( $attributes['column_1']['button_weight'] ) ? $attributes['column_1']['button_weight'] : 'normal', |
| 172 |
'type' => 'style', |
| 173 |
], |
| 174 |
|
| 175 |
'button_font_family' => [ |
| 176 |
'value' => isset( $attributes['column_1']['button_font_family'] ) ? $attributes['column_1']['button_font_family'] : YAYMAIL_DEFAULT_FAMILY, |
| 177 |
'type' => 'style', |
| 178 |
], |
| 179 |
], |
| 180 |
'column_2' => [ |
| 181 |
'padding' => [ |
| 182 |
'value' => isset( $attributes['column_2']['padding'] ) ? $attributes['column_2']['padding'] : [ |
| 183 |
'top' => '10', |
| 184 |
'right' => '50', |
| 185 |
'bottom' => '10', |
| 186 |
'left' => '10', |
| 187 |
], |
| 188 |
'type' => 'style', |
| 189 |
], |
| 190 |
|
| 191 |
'font_family' => [ |
| 192 |
'value' => isset( $attributes['column_2']['font_family'] ) ? $attributes['column_2']['font_family'] : YAYMAIL_DEFAULT_FAMILY, |
| 193 |
'type' => 'style', |
| 194 |
], |
| 195 |
|
| 196 |
'rich_text' => [ |
| 197 |
'value' => isset( $attributes['column_2']['rich_text'] ) ? $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>', |
| 198 |
'type' => 'content', |
| 199 |
], |
| 200 |
|
| 201 |
'show_button' => [ |
| 202 |
'value' => isset( $attributes['column_2']['show_button'] ) ? $attributes['column_2']['show_button'] : true, |
| 203 |
'type' => 'content', |
| 204 |
], |
| 205 |
|
| 206 |
'button_type' => [ |
| 207 |
'value' => isset( $attributes['column_2']['button_type'] ) ? $attributes['column_2']['button_type'] : 'default', |
| 208 |
'type' => 'style', |
| 209 |
], |
| 210 |
|
| 211 |
'button_align' => [ |
| 212 |
'value' => isset( $attributes['column_2']['button_align'] ) ? $attributes['column_2']['button_align'] : 'center', |
| 213 |
'type' => 'style', |
| 214 |
], |
| 215 |
|
| 216 |
'button_padding' => [ |
| 217 |
'value' => isset( $attributes['column_2']['button_padding'] ) ? $attributes['column_2']['button_padding'] : [ |
| 218 |
'top' => '0', |
| 219 |
'right' => '0', |
| 220 |
'bottom' => '0', |
| 221 |
'left' => '10', |
| 222 |
], |
| 223 |
'type' => 'style', |
| 224 |
], |
| 225 |
|
| 226 |
'button_border_radius' => [ |
| 227 |
'value' => isset( $attributes['column_2']['button_border_radius'] ) ? $attributes['column_2']['button_border_radius'] : [ |
| 228 |
'top_left' => '5', |
| 229 |
'top_right' => '5', |
| 230 |
'bottom_right' => '5', |
| 231 |
'bottom_left' => '5', |
| 232 |
], |
| 233 |
'type' => 'style', |
| 234 |
], |
| 235 |
|
| 236 |
'button_text' => [ |
| 237 |
'value' => isset( $attributes['column_2']['button_text'] ) ? $attributes['column_2']['button_text'] : __( 'Click me', 'yaymail' ), |
| 238 |
'type' => 'content', |
| 239 |
], |
| 240 |
|
| 241 |
'button_url' => [ |
| 242 |
'value' => isset( $attributes['column_2']['button_url'] ) ? $attributes['column_2']['button_url'] : '#', |
| 243 |
'type' => 'content', |
| 244 |
], |
| 245 |
|
| 246 |
'button_background_color' => [ |
| 247 |
'value' => isset( $attributes['column_2']['button_background_color'] ) ? $attributes['column_2']['button_background_color'] : YAYMAIL_COLOR_WC_DEFAULT, |
| 248 |
'type' => 'style', |
| 249 |
], |
| 250 |
|
| 251 |
'button_text_color' => [ |
| 252 |
'value' => isset( $attributes['column_2']['button_text_color'] ) ? $attributes['column_2']['button_text_color'] : '#ffffff', |
| 253 |
'type' => 'style', |
| 254 |
], |
| 255 |
|
| 256 |
'button_font_size' => [ |
| 257 |
'value' => isset( $attributes['column_2']['button_font_size'] ) ? $attributes['column_2']['button_font_size'] : '13', |
| 258 |
'type' => 'style', |
| 259 |
], |
| 260 |
|
| 261 |
'button_height' => [ |
| 262 |
'value' => isset( $attributes['column_2']['button_height'] ) ? $attributes['column_2']['button_height'] : '21', |
| 263 |
'type' => 'style', |
| 264 |
], |
| 265 |
|
| 266 |
'button_width' => [ |
| 267 |
'value' => isset( $attributes['column_2']['button_width'] ) ? $attributes['column_2']['button_width'] : '35', |
| 268 |
'type' => 'style', |
| 269 |
], |
| 270 |
|
| 271 |
'button_weight' => [ |
| 272 |
'value' => isset( $attributes['column_2']['button_weight'] ) ? $attributes['column_2']['button_weight'] : 'normal', |
| 273 |
'type' => 'style', |
| 274 |
], |
| 275 |
|
| 276 |
'button_font_family' => [ |
| 277 |
'value' => isset( $attributes['column_2']['button_font_family'] ) ? $attributes['column_2']['button_font_family'] : YAYMAIL_DEFAULT_FAMILY, |
| 278 |
'type' => 'style', |
| 279 |
], |
| 280 |
], |
| 281 |
'column_3' => [ |
| 282 |
'padding' => [ |
| 283 |
'value' => isset( $attributes['column_3']['padding'] ) ? $attributes['column_3']['padding'] : [ |
| 284 |
'top' => '10', |
| 285 |
'right' => '50', |
| 286 |
'bottom' => '10', |
| 287 |
'left' => '10', |
| 288 |
], |
| 289 |
'type' => 'style', |
| 290 |
], |
| 291 |
|
| 292 |
'font_family' => [ |
| 293 |
'value' => isset( $attributes['column_3']['font_family'] ) ? $attributes['column_3']['font_family'] : YAYMAIL_DEFAULT_FAMILY, |
| 294 |
'type' => 'style', |
| 295 |
], |
| 296 |
|
| 297 |
'rich_text' => [ |
| 298 |
'value' => isset( $attributes['column_3']['rich_text'] ) ? $attributes['column_3']['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>', |
| 299 |
'type' => 'content', |
| 300 |
], |
| 301 |
|
| 302 |
'show_button' => [ |
| 303 |
'value' => isset( $attributes['column_3']['show_button'] ) ? $attributes['column_3']['show_button'] : true, |
| 304 |
'type' => 'content', |
| 305 |
], |
| 306 |
|
| 307 |
'button_type' => [ |
| 308 |
'value' => isset( $attributes['column_3']['button_type'] ) ? $attributes['column_3']['button_type'] : 'default', |
| 309 |
'type' => 'style', |
| 310 |
], |
| 311 |
|
| 312 |
'button_align' => [ |
| 313 |
'value' => isset( $attributes['column_3']['button_align'] ) ? $attributes['column_3']['button_align'] : 'center', |
| 314 |
'type' => 'style', |
| 315 |
], |
| 316 |
|
| 317 |
'button_padding' => [ |
| 318 |
'value' => isset( $attributes['column_3']['button_padding'] ) ? $attributes['column_3']['button_padding'] : [ |
| 319 |
'top' => '0', |
| 320 |
'right' => '40', |
| 321 |
'bottom' => '0', |
| 322 |
'left' => '10', |
| 323 |
], |
| 324 |
'type' => 'style', |
| 325 |
], |
| 326 |
|
| 327 |
'button_border_radius' => [ |
| 328 |
'value' => isset( $attributes['column_3']['button_border_radius'] ) ? $attributes['column_3']['button_border_radius'] : [ |
| 329 |
'top_left' => '5', |
| 330 |
'top_right' => '5', |
| 331 |
'bottom_right' => '5', |
| 332 |
'bottom_left' => '5', |
| 333 |
], |
| 334 |
'type' => 'style', |
| 335 |
], |
| 336 |
|
| 337 |
'button_text' => [ |
| 338 |
'value' => isset( $attributes['column_3']['button_text'] ) ? $attributes['column_3']['button_text'] : __( 'Click me', 'yaymail' ), |
| 339 |
'type' => 'content', |
| 340 |
], |
| 341 |
|
| 342 |
'button_url' => [ |
| 343 |
'value' => isset( $attributes['column_3']['button_url'] ) ? $attributes['column_3']['button_url'] : '#', |
| 344 |
'type' => 'content', |
| 345 |
], |
| 346 |
|
| 347 |
'button_background_color' => [ |
| 348 |
'value' => isset( $attributes['column_3']['button_background_color'] ) ? $attributes['column_3']['button_background_color'] : YAYMAIL_COLOR_WC_DEFAULT, |
| 349 |
'type' => 'style', |
| 350 |
], |
| 351 |
|
| 352 |
'button_text_color' => [ |
| 353 |
'value' => isset( $attributes['column_3']['button_text_color'] ) ? $attributes['column_3']['button_text_color'] : '#ffffff', |
| 354 |
'type' => 'style', |
| 355 |
], |
| 356 |
|
| 357 |
'button_font_size' => [ |
| 358 |
'value' => isset( $attributes['column_3']['button_font_size'] ) ? $attributes['column_3']['button_font_size'] : '13', |
| 359 |
'type' => 'style', |
| 360 |
], |
| 361 |
|
| 362 |
'button_height' => [ |
| 363 |
'value' => isset( $attributes['column_3']['button_height'] ) ? $attributes['column_3']['button_height'] : '21', |
| 364 |
'type' => 'style', |
| 365 |
], |
| 366 |
|
| 367 |
'button_width' => [ |
| 368 |
'value' => isset( $attributes['column_3']['button_width'] ) ? $attributes['column_3']['button_width'] : '35', |
| 369 |
'type' => 'style', |
| 370 |
], |
| 371 |
|
| 372 |
'button_weight' => [ |
| 373 |
'value' => isset( $attributes['column_3']['button_weight'] ) ? $attributes['column_3']['button_weight'] : 'normal', |
| 374 |
'type' => 'style', |
| 375 |
], |
| 376 |
|
| 377 |
'button_font_family' => [ |
| 378 |
'value' => isset( $attributes['column_3']['button_font_family'] ) ? $attributes['column_3']['button_font_family'] : YAYMAIL_DEFAULT_FAMILY, |
| 379 |
'type' => 'style', |
| 380 |
], |
| 381 |
], |
| 382 |
], |
| 383 |
], |
| 384 |
]; |
| 385 |
} |
| 386 |
} |
| 387 |
|