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 / container.php

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

98 lines 2.8 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\Elements\ElementsLoader;
5 use YayMail\Utils\TemplateHelpers;
6
7 /**
8 * $args includes
9 * $element
10 * $render_data
11 * $is_nested
12 */
13 if ( empty( $args['element'] ) ) {
14 return;
15 }
16
17 $element = $args['element'];
18 $data = $element['data'];
19 $direction = isset( $data['direction'] ) ? $data['direction'] : 'vertical';
20
21 if ( 'horizontal' === $direction ) {
22 $args['is_horizontal'] = true;
23 }
24
25 $wrapper_style = TemplateHelpers::get_style(
26 [
27 'background-color' => $data['background_color'],
28 'padding' => TemplateHelpers::get_spacing_value( isset( $data['padding'] ) ? $data['padding'] : [] ),
29 'overflow' => 'hidden',
30 ]
31 );
32
33 if ( isset( $data['background_image'], $data['background_image']['url'] ) ) {
34 $background_image = $data['background_image'];
35 // Calculate background-position
36 $background_position = str_replace( '_', ' ', $background_image['position'] );
37 if ( ! isset( $background_image['position'] ) || 'default' === $background_image['position'] ) {
38 $background_position = 'unset';
39 } elseif ( 'custom' === $background_image['position'] ) {
40 $background_position = "{$background_image['x_position']}% {$background_image['y_position']}%";
41 }
42
43 // Calculate background-repeat
44 if ( ! isset( $background_image['repeat'] ) || 'default' === $background_image['repeat'] ) {
45 $background_repeat = 'unset';
46 } else {
47 $background_repeat = $background_image['repeat'];
48 }
49
50 // Calculate background-size
51 $background_size = $background_image['size'];
52
53 if ( 'default' === $background_size ) {
54 $background_size = 'unset';
55 } elseif ( 'custom' === $background_size ) {
56 $background_size = "{$background_image['custom_size']}%";
57 }
58
59 $wrapper_style .= TemplateHelpers::get_style(
60 [
61 'background-image' => "url({$background_image['url']})",
62 'background-position' => $background_position,
63 'background-repeat' => $background_repeat,
64 'background-size' => $background_size,
65 ]
66 );
67 }//end if
68
69 $inner_style = TemplateHelpers::get_style(
70 [
71 'width' => '100%',
72 'overflow' => 'hidden',
73 ]
74 );
75
76
77 ob_start();
78 ?>
79
80 <div class="yaymail-inner-customizer-element-container" style="<?php echo esc_attr( $inner_style ); ?>">
81 <table style="width: 100%; background-color: inherit;" cellpadding="0" cellspacing="0" width="100%">
82 <tbody>
83 <?php
84 ElementsLoader::render_elements(
85 $element['children'],
86 $args
87 );
88 ?>
89 </tbody>
90 </table>
91 </div>
92
93
94 <?php
95 $element_content = ob_get_clean();
96
97 TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
98