| 1 |
<?php |
| 2 |
namespace YayMail\Elements; |
| 3 |
|
| 4 |
use YayMail\Abstracts\BaseElement; |
| 5 |
use YayMail\Utils\SingletonTrait; |
| 6 |
/** |
| 7 |
* Video Elements |
| 8 |
*/ |
| 9 |
class Video extends BaseElement { |
| 10 |
|
| 11 |
use SingletonTrait; |
| 12 |
|
| 13 |
protected static $type = 'video'; |
| 14 |
|
| 15 |
public $available_email_ids = [ YAYMAIL_ALL_EMAILS ]; |
| 16 |
|
| 17 |
public static function get_data( $attributes = [] ) { |
| 18 |
$default_src = esc_url( YAYMAIL_PLUGIN_URL . 'assets/images/default-photo.png' ); |
| 19 |
self::$icon = '<svg viewBox="64 64 896 896" data-icon="video-camera" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226zM208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"></path></svg>'; |
| 20 |
|
| 21 |
return [ |
| 22 |
'id' => uniqid(), |
| 23 |
'type' => self::$type, |
| 24 |
'name' => __( 'Video', 'yaymail' ), |
| 25 |
'icon' => self::$icon, |
| 26 |
'group' => 'basic', |
| 27 |
'available' => true, |
| 28 |
'position' => 100, |
| 29 |
'data' => [ |
| 30 |
'container_group_definition' => [ |
| 31 |
'component' => 'GroupDefinition', |
| 32 |
'title' => __( 'Container settings', 'yaymail' ), |
| 33 |
'description' => __( 'Handle container layout settings', 'yaymail' ), |
| 34 |
], |
| 35 |
'padding' => [ |
| 36 |
'value_path' => 'padding', |
| 37 |
'component' => 'Spacing', |
| 38 |
'title' => __( 'Padding', 'yaymail' ), |
| 39 |
'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [ |
| 40 |
'top' => '15', |
| 41 |
'right' => '50', |
| 42 |
'bottom' => '15', |
| 43 |
'left' => '50', |
| 44 |
], |
| 45 |
'type' => 'style', |
| 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 |
'content_breaker' => [ |
| 55 |
'component' => 'LineBreaker', |
| 56 |
], |
| 57 |
'content_group_definition' => [ |
| 58 |
'component' => 'GroupDefinition', |
| 59 |
'title' => __( 'Content settings', 'yaymail' ), |
| 60 |
'description' => __( 'Handle content settings', 'yaymail' ), |
| 61 |
], |
| 62 |
'src' => [ |
| 63 |
'value_path' => 'src', |
| 64 |
'component' => 'Media', |
| 65 |
'title' => __( 'Thumbnail', 'yaymail' ), |
| 66 |
'default_value' => isset( $attributes['src'] ) ? $attributes['src'] : $default_src, |
| 67 |
'type' => 'content', |
| 68 |
], |
| 69 |
'width' => [ |
| 70 |
'value_path' => 'width', |
| 71 |
'component' => 'Dimension', |
| 72 |
'title' => __( 'Width', 'yaymail' ), |
| 73 |
'default_value' => isset( $attributes['width'] ) ? $attributes['width'] : '400', |
| 74 |
'type' => 'style', |
| 75 |
], |
| 76 |
'height' => [ |
| 77 |
'value_path' => 'height', |
| 78 |
'component' => 'Dimension', |
| 79 |
'title' => __( 'Height', 'yaymail' ), |
| 80 |
'default_value' => isset( $attributes['height'] ) ? $attributes['height'] : '400', |
| 81 |
'type' => 'style', |
| 82 |
], |
| 83 |
'url' => [ |
| 84 |
'value_path' => 'url', |
| 85 |
'component' => 'Media', |
| 86 |
'title' => __( 'Video URL', 'yaymail' ), |
| 87 |
'default_value' => isset( $attributes['url'] ) ? $attributes['url'] : '#', |
| 88 |
'media_type' => 'video', |
| 89 |
'button_title' => __( 'Change video', 'yaymail' ), |
| 90 |
'show_preview' => false, |
| 91 |
'type' => 'content', |
| 92 |
], |
| 93 |
], |
| 94 |
]; |
| 95 |
} |
| 96 |
} |
| 97 |
|