1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
<?php defined( 'ABSPATH' ) || exit;
use YayMail\Utils\TemplateHelpers;
/** * $args includes * $element * $render_data * $is_nested */ if ( empty( $args['element'] ) ) { return; }
$element = $args['element']; $data = $element['data'];
$wrapper_style = TemplateHelpers::get_style( [ 'word-break' => 'break-word', 'text-align' => 'center', 'background-color' => $data['background_color'], 'padding' => TemplateHelpers::get_spacing_value( isset( $data['padding'] ) ? $data['padding'] : [] ), ] );
$thumbnail_cell_style = TemplateHelpers::get_style( [ 'background-image' => ! empty( $data['src'] ) ? "url({$data['src']})" : '', 'background-size' => 'cover', 'background-position' => 'center', 'width' => "{$data['width']}px", 'height' => "{$data['height']}px", 'text-align' => 'center', 'vertical-align' => 'middle', 'display' => 'table-cell', ] );
// Play button style for email $btn_play_style = TemplateHelpers::get_style( [ 'width' => '56px', 'height' => '56px', 'border' => 'none', 'outline' => 'none', 'display' => 'block', 'margin' => 'auto', ] );
$td_style = TemplateHelpers::get_style( [ 'text-align' => 'center', 'padding' => '0', 'height' => "{$data['height']}px", 'display' => 'inline-block', ] );
ob_start(); ?>
<table class="yaymail-customizer-element-video" role="presentation" border="0" align="center" cellpadding="0" cellspacing="0" style="display: table;border-collapse: collapse;width: 100%;text-align: center;"> <tbody> <tr> <td style="<?php echo esc_attr( $td_style ); ?>"> <a class="yaymail-customizer-element-video__anchor" href="<?php echo esc_url( isset( $data['url'] ) ? do_shortcode( $data['url'] ) : '#' ); ?>" style="text-decoration: none; display: inline-block;"> <div class="yaymail-customizer-element-video__thumbnail" style="<?php echo esc_attr( $thumbnail_cell_style ); ?>"> <img valign="middle" class="yaymail-customizer-element-video__btn-play" src="<?php echo esc_url( YAYMAIL_PLUGIN_URL . '/assets/images/play.png' ); ?>" alt="Play video" style="<?php echo esc_attr( $btn_play_style ); ?>" /> </div> </a> </td> </tr> </tbody> </table>
<?php $element_content = ob_get_clean(); TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
|