| 1 |
<?php |
| 2 |
namespace YayMail\Elements; |
| 3 |
|
| 4 |
use YayMail\Abstracts\BaseElement; |
| 5 |
use YayMail\Utils\SingletonTrait; |
| 6 |
/** |
| 7 |
* SocialIcon Elements |
| 8 |
*/ |
| 9 |
class SocialIcon extends BaseElement { |
| 10 |
|
| 11 |
use SingletonTrait; |
| 12 |
|
| 13 |
protected static $type = 'social_icon'; |
| 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 |
<path d="M15.51,13.49c-.65,0-1.26.23-1.73.61l-4.76-3.44c.08-.44.08-.89,0-1.32l4.76-3.44c.47.38,1.08.61,1.73.61,1.52,0,2.76-1.24,2.76-2.76s-1.24-2.76-2.76-2.76-2.76,1.24-2.76,2.76c0,.27.04.52.11.76l-4.52,3.27c-.67-.89-1.74-1.46-2.94-1.46-2.03,0-3.67,1.64-3.67,3.67s1.64,3.67,3.67,3.67c1.2,0,2.27-.58,2.94-1.46l4.52,3.27c-.07.24-.11.5-.11.76,0,1.52,1.24,2.76,2.76,2.76s2.76-1.24,2.76-2.76-1.24-2.76-2.76-2.76ZM15.51,2.56c.66,0,1.19.53,1.19,1.19s-.53,1.19-1.19,1.19-1.19-.53-1.19-1.19.53-1.19,1.19-1.19ZM5.41,12.02c-1.11,0-2.02-.91-2.02-2.02s.91-2.02,2.02-2.02,2.02.91,2.02,2.02-.91,2.02-2.02,2.02ZM15.51,17.44c-.66,0-1.19-.54-1.19-1.19s.53-1.19,1.19-1.19,1.19.53,1.19,1.19-.53,1.19-1.19,1.19Z"/> |
| 20 |
</svg>'; |
| 21 |
|
| 22 |
return [ |
| 23 |
'id' => uniqid(), |
| 24 |
'type' => self::$type, |
| 25 |
'name' => __( 'Social Icon', 'yaymail' ), |
| 26 |
'icon' => self::$icon, |
| 27 |
'group' => 'basic', |
| 28 |
'available' => true, |
| 29 |
'position' => 90, |
| 30 |
'data' => [ |
| 31 |
'container_group_definition' => [ |
| 32 |
'component' => 'GroupDefinition', |
| 33 |
'title' => __( 'Container settings', 'yaymail' ), |
| 34 |
'description' => __( 'Handle container layout settings', 'yaymail' ), |
| 35 |
], |
| 36 |
'padding' => [ |
| 37 |
'value_path' => 'padding', |
| 38 |
'component' => 'Spacing', |
| 39 |
'title' => __( 'Padding', 'yaymail' ), |
| 40 |
'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [ |
| 41 |
'top' => '15', |
| 42 |
'right' => '50', |
| 43 |
'bottom' => '15', |
| 44 |
'left' => '50', |
| 45 |
], |
| 46 |
'type' => 'style', |
| 47 |
], |
| 48 |
'background_color' => [ |
| 49 |
'value_path' => 'background_color', |
| 50 |
'component' => 'Color', |
| 51 |
'title' => __( 'Background color', 'yaymail' ), |
| 52 |
'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff', |
| 53 |
'type' => 'style', |
| 54 |
], |
| 55 |
'align' => [ |
| 56 |
'value_path' => 'align', |
| 57 |
'component' => 'Align', |
| 58 |
'title' => __( 'Alignment', 'yaymail' ), |
| 59 |
'default_value' => isset( $attributes['align'] ) ? $attributes['align'] : 'center', |
| 60 |
'type' => 'style', |
| 61 |
], |
| 62 |
'content_breaker' => [ |
| 63 |
'component' => 'LineBreaker', |
| 64 |
], |
| 65 |
'content_group_definition' => [ |
| 66 |
'component' => 'GroupDefinition', |
| 67 |
'title' => __( 'Content settings', 'yaymail' ), |
| 68 |
'description' => __( 'Handle content settings', 'yaymail' ), |
| 69 |
], |
| 70 |
'width_icon' => [ |
| 71 |
'value_path' => 'width_icon', |
| 72 |
'component' => 'Dimension', |
| 73 |
'title' => __( 'Icon size', 'yaymail' ), |
| 74 |
'default_value' => isset( $attributes['width_icon'] ) ? $attributes['width_icon'] : '24', |
| 75 |
'min' => 0, |
| 76 |
'max' => 100, |
| 77 |
'type' => 'style', |
| 78 |
], |
| 79 |
'spacing' => [ |
| 80 |
'value_path' => 'spacing', |
| 81 |
'component' => 'Dimension', |
| 82 |
'title' => __( 'Icon spacing', 'yaymail' ), |
| 83 |
'default_value' => isset( $attributes['spacing'] ) ? $attributes['spacing'] : '5', |
| 84 |
'min' => 0, |
| 85 |
'max' => 100, |
| 86 |
'type' => 'style', |
| 87 |
], |
| 88 |
'theme' => [ |
| 89 |
'value_path' => 'theme', |
| 90 |
'component' => 'SocialIconThemeSelector', |
| 91 |
'title' => __( 'Styles theme', 'yaymail' ), |
| 92 |
'default_value' => isset( $attributes['style'] ) ? $attributes['style'] : 'Colorful', |
| 93 |
'type' => 'style', |
| 94 |
], |
| 95 |
'icon_list' => [ |
| 96 |
'value_path' => 'icon_list', |
| 97 |
'component' => 'SocialList', |
| 98 |
'title' => __( 'Social', 'yaymail' ), |
| 99 |
'default_value' => isset( $attributes['icon_list'] ) ? $attributes['icon_list'] : [ |
| 100 |
[ |
| 101 |
'icon' => 'facebook', |
| 102 |
'url' => '#', |
| 103 |
], |
| 104 |
[ |
| 105 |
'icon' => 'instagram', |
| 106 |
'url' => '#', |
| 107 |
], |
| 108 |
[ |
| 109 |
'icon' => 'linkedin', |
| 110 |
'url' => '#', |
| 111 |
], |
| 112 |
], |
| 113 |
'type' => 'content', |
| 114 |
], |
| 115 |
], |
| 116 |
]; |
| 117 |
} |
| 118 |
} |
| 119 |
|