| 1 |
<?php |
| 2 |
namespace YayMail\Elements; |
| 3 |
|
| 4 |
use YayMail\Abstracts\BaseElement; |
| 5 |
use YayMail\Utils\SingletonTrait; |
| 6 |
|
| 7 |
/** |
| 8 |
* Hook Elements |
| 9 |
*/ |
| 10 |
class Hook extends BaseElement { |
| 11 |
|
| 12 |
use SingletonTrait; |
| 13 |
|
| 14 |
protected static $type = 'hook'; |
| 15 |
|
| 16 |
public $available_email_ids = [ YAYMAIL_ALL_EMAILS ]; |
| 17 |
|
| 18 |
public static function get_data( $attributes = [] ) { |
| 19 |
self::$icon = '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 20 20"> |
| 20 |
<path d="M13.97,1c-1.16,0-2.11.95-2.11,2.11,0,.92.59,1.7,1.41,1.99v8.52c0,2.19-1.78,3.97-3.97,3.97s-3.97-1.78-3.97-3.97h2.46l-3.87-3.87v3.87c0,2.97,2.41,5.38,5.38,5.38s5.38-2.41,5.38-5.38V5.1c.82-.29,1.41-1.07,1.41-1.99,0-1.16-.95-2.11-2.11-2.11ZM13.97,3.81c-.39,0-.7-.32-.7-.7s.32-.7.7-.7.7.32.7.7-.32.7-.7.7Z"/> |
| 21 |
</svg>'; |
| 22 |
|
| 23 |
return [ |
| 24 |
'id' => uniqid(), |
| 25 |
'type' => self::$type, |
| 26 |
'name' => __( 'Hook', 'yaymail' ), |
| 27 |
'icon' => self::$icon, |
| 28 |
'group' => 'woocommerce', |
| 29 |
'available' => true, |
| 30 |
'position' => 210, |
| 31 |
'data' => [ |
| 32 |
'padding' => [ |
| 33 |
'value_path' => 'padding', |
| 34 |
'component' => 'Spacing', |
| 35 |
'title' => __( 'Padding', 'yaymail' ), |
| 36 |
'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [ |
| 37 |
'top' => '15', |
| 38 |
'right' => '50', |
| 39 |
'bottom' => '15', |
| 40 |
'left' => '50', |
| 41 |
], |
| 42 |
'type' => 'style', |
| 43 |
], |
| 44 |
'background_color' => [ |
| 45 |
'value_path' => 'background_color', |
| 46 |
'component' => 'Color', |
| 47 |
'title' => __( 'Background color', 'yaymail' ), |
| 48 |
'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff', |
| 49 |
'type' => 'style', |
| 50 |
], |
| 51 |
'text_color' => [ |
| 52 |
'value_path' => 'text_color', |
| 53 |
'component' => 'Color', |
| 54 |
'title' => __( 'Text color', 'yaymail' ), |
| 55 |
'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : YAYMAIL_COLOR_TEXT_DEFAULT, |
| 56 |
'type' => 'style', |
| 57 |
], |
| 58 |
'hook_shortcode' => [ |
| 59 |
'value_path' => 'hook_shortcode', |
| 60 |
'component' => 'HookSelector', |
| 61 |
'title' => __( 'Hook shortcode', 'yaymail' ), |
| 62 |
'default_value' => isset( $attributes['rich_text'] ) ? $attributes['hook_shortcode'] : '[yaymail_custom_hook hook="woocommerce_email_before_order_table"]', |
| 63 |
'type' => 'content', |
| 64 |
], |
| 65 |
'font_family' => [ |
| 66 |
'value_path' => 'font_family', |
| 67 |
'component' => 'FontFamilySelector', |
| 68 |
'title' => __( 'Font family', 'yaymail' ), |
| 69 |
'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : YAYMAIL_DEFAULT_FAMILY, |
| 70 |
'type' => 'style', |
| 71 |
], |
| 72 |
], |
| 73 |
]; |
| 74 |
} |
| 75 |
} |
| 76 |
|