PluginProbe
YayMail – WooCommerce Email Customizer / 4.3.2
YayMail – WooCommerce Email Customizer v4.3.2
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 / column-layout.php

column-layout.php in YayMail – WooCommerce Email Customizer 4.3.2, at templates/elements/column-layout.php

113 lines 3.4 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
20 $wrapper_style = TemplateHelpers::get_style(
21 [
22 'background-color' => $data['background_color'],
23 'padding' => TemplateHelpers::get_spacing_value( isset( $data['padding'] ) ? $data['padding'] : [] ),
24 ]
25 );
26
27 if ( isset( $data['background_image'], $data['background_image']['url'] ) ) {
28 $background_image = $data['background_image'];
29 // Calculate background-position
30 $background_position = str_replace( '_', ' ', $background_image['position'] );
31 if ( ! isset( $background_image['position'] ) || 'default' === $background_image['position'] ) {
32 $background_position = 'unset';
33 } elseif ( 'custom' === $background_image['position'] ) {
34 $background_position = "{$background_image['x_position']}% {$background_image['y_position']}%";
35 }
36
37 // Calculate background-repeat
38 if ( ! isset( $background_image['repeat'] ) || 'default' === $background_image['repeat'] ) {
39 $background_repeat = 'unset';
40 } else {
41 $background_repeat = $background_image['repeat'];
42 }
43
44 // Calculate background-size
45 $background_size = $background_image['size'];
46
47 if ( 'default' === $background_size ) {
48 $background_size = 'unset';
49 } elseif ( 'custom' === $background_size ) {
50 $background_size = "{$background_image['custom_size']}%";
51 }
52
53 $wrapper_style .= TemplateHelpers::get_style(
54 [
55 'background-image' => "url({$background_image['url']})",
56 'background-position' => $background_position,
57 'background-repeat' => $background_repeat,
58 'background-size' => $background_size,
59 ]
60 );
61 }//end if
62
63 if ( isset( $data['border_radius'] ) ) {
64 $wrapper_style .= TemplateHelpers::get_style(
65 [
66 'border-radius' => TemplateHelpers::get_border_radius_value( $data['border_radius'], 'px' ),
67 'overflow' => 'hidden',
68 ]
69 );
70 }//end if
71
72 if ( ! empty( $element['children'] ) ) {
73 $inner_styles = '';
74 if ( 'column_layout' === $element['type'] ) {
75
76 $inner_border_radius = $data['inner_border_radius'];
77 $inner_background_color = $data['inner_background_color'];
78
79 $inner_styles = TemplateHelpers::get_style(
80 [
81 'border-radius' => TemplateHelpers::get_border_radius_value( $inner_border_radius, 'px' ),
82 'overflow' => 'hidden',
83 'background-color' => $inner_background_color,
84 ]
85 );
86 }
87 }
88
89 ob_start();
90 if ( 'column_layout' === $element['type'] ) : ?>
91 <div class="yaymail-inner-customizer-element-column" style="<?php echo esc_attr( $inner_styles ); ?>">
92 <?php endif; ?>
93
94 <table style="width: 100%; background-color: inherit;" cellpadding="0" cellspacing="0">
95 <tbody>
96 <?php
97 ElementsLoader::render_elements(
98 $element['children'],
99 $args
100 );
101 ?>
102 </tbody>
103 </table>
104
105 <?php if ( 'column_layout' === $element['type'] ) : ?>
106 </div>
107 <?php endif; ?>
108
109 <?php
110 $element_content = ob_get_clean();
111
112 TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
113