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 / column-layout.php

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

89 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\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 ob_start();
73 ?>
74 <table style="width: 100%; background-color: inherit;" cellpadding="0" cellspacing="0">
75 <tbody>
76 <?php
77 ElementsLoader::render_elements(
78 $element['children'],
79 $args
80 );
81 ?>
82 </tbody>
83 </table>
84
85 <?php
86 $element_content = ob_get_clean();
87
88 TemplateHelpers::wrap_element_content( $element_content, $element, $wrapper_style );
89