PluginProbe
YayMail – WooCommerce Email Customizer / trunk
YayMail – WooCommerce Email Customizer vtrunk
4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 3.4.2 3.4.3 All 55 releases
yaymail / templates / elements / video.php

video.php in YayMail – WooCommerce Email Customizer trunk, at templates/elements/video.php

83 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit;
3
4 use YayMail\Utils\TemplateHelpers;
5
6 /**
7 * $args includes
8 * $element
9 * $render_data
10 * $is_nested
11 */
12 if ( empty( $args['element'] ) ) {
13 return;
14 }
15
16 $element = $args['element'];
17 $data = $element['data'];
18
19 $wrapper_style = TemplateHelpers::get_style(
20 [
21 'word-break' => 'break-word',
22 'text-align' => 'center',
23 'background-color' => $data['background_color'],
24 'padding' => TemplateHelpers::get_spacing_value( isset( $data['padding'] ) ? $data['padding'] : [] ),
25 ]
26 );
27
28 $thumbnail_cell_style = TemplateHelpers::get_style(
29 [
30 'background-image' => ! empty( $data['src'] ) ? "url({$data['src']})" : '',
31 'background-size' => 'cover',
32 'background-position' => 'center',
33 'width' => "{$data['width']}px",
34 'height' => "{$data['height']}px",
35 'text-align' => 'center',
36 'vertical-align' => 'middle',
37 'display' => 'table-cell',
38 ]
39 );
40
41 // Play button style for email
42 $btn_play_style = TemplateHelpers::get_style(
43 [
44 'width' => '56px',
45 'height' => '56px',
46 'border' => 'none',
47 'outline' => 'none',
48 'display' => 'block',
49 'margin' => 'auto',
50 ]
51 );
52
53 $td_style = TemplateHelpers::get_style(
54 [
55 'text-align' => 'center',
56 'padding' => '0',
57 'height' => "{$data['height']}px",
58 'display' => 'inline-block',
59 ]
60 );
61
62 ob_start();
63 ?>
64
65 <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;">
66 <tbody>
67 <tr>
68 <td style="<?php echo esc_attr( $td_style ); ?>">
69 <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;">
70 <div class="yaymail-customizer-element-video__thumbnail" style="<?php echo esc_attr( $thumbnail_cell_style ); ?>">
71 <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 ); ?>" />
72 </div>
73 </a>
74 </td>
75 </tr>
76 </tbody>
77 </table>
78
79
80 <?php
81 $element_content = ob_get_clean();
82 TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
83