PluginProbe
Themify Builder / 7.7.0
Themify Builder v7.7.0
7.8.1 7.8.0 7.7.9 7.7.8 7.7.7 7.7.6 7.7.5 7.7.4 7.7.3 7.7.2 trunk 7.6.0 7.6.1 7.6.2 7.6.3 7.6.4 7.6.5 7.6.6 7.6.7 7.6.8 7.6.9 7.7.0 7.7.1
themify-builder / includes / components / row.php

row.php in Themify Builder 7.7.0, at includes/components/row.php

541 lines 26.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 class Themify_Builder_Component_Row{
5
6 public static $isFirstRow = false;
7
8
9 /**
10 * Computes and returns data for Builder row or column video background.
11 *
12 * @since 2.3.3
13 *
14 * @param array $styling The row's or column's styling array.
15 *
16 * @return string Return video data if row/col has a background video, else return false.
17 */
18 public static function get_video_background(array $styling):string {
19 if (!( isset($styling['background_type']) && 'video' === $styling['background_type'] && !empty($styling['background_video']) )) {
20 return '';
21 }
22 $video_data = 'data-tbfullwidthvideo="' . esc_url(themify_https_esc($styling['background_video'])) . '"';
23
24 // Will only be written if they exist, for backwards compatibility with global JS variable tbLocalScript.backgroundVideoLoop
25
26
27 if (!empty($styling['background_video_options'])) {
28 if (is_array($styling['background_video_options'])) {
29 $video_data .= in_array('mute', $styling['background_video_options'], true) ? '' : ' data-mutevideo="unmute"';
30 $video_data .= in_array('unloop', $styling['background_video_options'], true) ? ' data-unloopvideo="unloop"' : '';
31 $video_data .= in_array('playonmobile', $styling['background_video_options'], true) ? ' data-playonmobile="play"' : '';
32 } else {
33 $video_data .= ( false !== stripos($styling['background_video_options'], 'mute') ) ? '' : ' data-mutevideo="unmute"';
34 $video_data .= ( false !== stripos($styling['background_video_options'], 'unloop') ) ? ' data-unloopvideo="unloop"' : '';
35 $video_data .= ( false !== stripos($styling['background_video_options'], 'playonmobile') ) ? ' data-playonmobile="play"' : '';
36 }
37 }
38 return apply_filters('themify_builder_row_video_background', $video_data, $styling);
39 }
40
41 /**
42 * Computes and returns the HTML a color overlay.
43 *
44 * @since 2.3.3
45 *
46 * @param array $styling The row's or column's styling array.
47 *
48 * @return bool Returns false if $styling doesn't have a color overlay. Otherwise outputs the HTML;
49 */
50 private static function do_color_overlay(array $styling, $selector = ''):bool {
51
52 $type = !isset($styling['cover_color-type']) || $styling['cover_color-type'] === 'color' ? 'color' : 'gradient';
53 $is_empty = $type === 'color' ? ( empty($styling['cover_color']) && empty( $styling['cover_bg'] ) ) : empty($styling['cover_gradient-gradient']);
54 if ( $is_empty === true && ! empty( $styling['cover_backdrop'] ) ) {
55 $is_empty = false;
56 }
57
58 if ($is_empty === true) {
59 $hover_type = !isset($styling['cover_color_hover-type']) || $styling['cover_color_hover-type'] === 'hover_color' ? 'color' : 'gradient';
60 $is_empty_hover = $hover_type === 'color' ? ( empty($styling['cover_color_hover']) && empty($styling['cover_bg_h']) ) : empty($styling['cover_gradient_hover-gradient']);
61 if ( $is_empty_hover === true && ! empty( $styling['cover_backdrop_h'] ) ) {
62 $is_empty_hover = false;
63 }
64 }
65 if ($is_empty === false || $is_empty_hover === false) {
66 $attr = [
67 'class' => 'builder_row_cover tf_abs',
68 'data-lazy' => 1
69 ];
70 $attr = self::get_reveal_effect( $styling, $attr, 'cover_reveal' );
71
72 Themify_Builder_Component_Module::sticky_element_props( $attr, $styling, 'cover_' );
73 echo '<span ', themify_get_element_attributes($attr), '></span>';
74 return true;
75 }
76 return false;
77 }
78
79 private static function get_reveal_effect( array $styling, array $attr, string $option_prefix ) : array {
80 if ( ! empty( $styling[$option_prefix] ) ) {
81 $effect = $styling[$option_prefix];
82 $reveal_viewport = empty( $styling[$option_prefix . '_vp'] ) ? '0,100' : $styling[$option_prefix . '_vp'];
83 $minMaxSize = empty( $styling[$option_prefix . '_minmax'] ) ? '0,100' : $styling[$option_prefix . '_minmax'];
84 $attr['data-tb_clip'] = $effect . ',' . $reveal_viewport . ',' . $minMaxSize;
85 if ( $effect === 'sp' || $effect === 'r' || $effect === 'sw' ) {
86 $corner_radius_unit = empty( $styling[$option_prefix . '_br_unit'] ) ? 'px' : $styling[$option_prefix . '_br_unit'];
87 $attr['data-tb_clip_br'] = empty( $styling[$option_prefix . '_br'] ) ? '0' : $styling[$option_prefix . '_br'] . $corner_radius_unit;
88 }
89 if ( $effect === 'sp' ) {
90 if ( ! empty( $styling[$option_prefix . '_sp_dir'] ) && $styling[$option_prefix . '_sp_dir'] !== 'ho' ) {
91 $attr['data-tb_dir'] = $styling[$option_prefix . '_sp_dir'];
92 }
93 } else if ( $effect === 'c' || $effect === 'r' ) {
94 if ( ! empty( $styling[$option_prefix . '_zoomdir'] ) && $styling[$option_prefix . '_zoomdir'] !== 'i' ) {
95 $attr['data-tb_dir'] = $styling[$option_prefix . '_zoomdir'];
96 }
97 if ( ! empty( $styling[$option_prefix . '_pos'] ) ) {
98 $attr['data-tb_clip_pos'] = $styling[$option_prefix . '_pos'];
99 }
100 } else if ( $effect === 'sw' ) {
101 if ( ! empty( $styling[$option_prefix . '_sw_dir'] ) && $styling[$option_prefix . '_sw_dir'] !== 'l' ) {
102 $attr['data-tb_dir'] = $styling[$option_prefix . '_sw_dir'];
103 }
104 }
105 }
106
107 return $attr;
108 }
109
110 /**
111 * Get the frame type
112 */
113 private static function get_frame(array $settings, string $side):string {
114 if ((!isset($settings["{$side}-frame_type"]) || $settings["{$side}-frame_type"] === $side . '-presets') && !empty($settings["{$side}-frame_layout"])) {
115 return $settings["{$side}-frame_layout"] !== 'none' ? 'presets' : '';
116 }
117 if (isset($settings["{$side}-frame_type"]) && $settings["{$side}-frame_type"] === $side . '-custom' && !empty($settings["{$side}-frame_custom"])) {
118 return 'custom';
119 }
120 return '';
121 }
122
123 private static function show_frame(array $styles, $printed = array()) {
124 $breakpoints = array('desktop' => '') + themify_get_breakpoints();
125 $sides = array('top', 'bottom', 'left', 'right');
126 $output = '';
127 foreach ($sides as $side) {
128 if (!isset($printed[$side])) {
129 foreach ($breakpoints as $bp => $v) {
130 $settings = 'desktop' === $bp ? $styles : (!empty($styles['breakpoint_' . $bp]) ? $styles['breakpoint_' . $bp] : array() );
131 if (!empty($settings) && self::get_frame($settings, $side)) {
132 $printed[$side] = true;
133 $frame_location = ( isset($settings["{$side}-frame_location"]) && $settings["{$side}-frame_location"] === 'in_front' ) ? $settings["{$side}-frame_location"] : '';
134 $cl = $side === 'left' || $side === 'right' ? 'tf_h' : 'tf_w';
135 $output .= '<span class="tb_row_frame tb_row_frame_' . $side . ' ' . $frame_location . ' tf_abs tf_hide tf_overflow ' . $cl . '"></span>';
136 break;
137 }
138 }
139 }
140 }
141 if (!empty($output)) {
142 Themify_Builder_Model::loadCssModules('fr', THEMIFY_BUILDER_CSS_MODULES . 'frames.css', THEMIFY_VERSION);
143 echo '<span class="tb_row_frame_wrap tf_overflow tf_abs" data-lazy="1">', $output, '</span>';
144 }
145 return $printed;
146 }
147
148 public static function background_styling(array $row, string $type, $builder_id) {
149 // Background cover color
150 if (!empty($row['styling'])) {
151 $hasOverlay = false;
152 $selector = '.themify_builder_content-' . $builder_id . ' .tb_' . $row['element_id'] . ' > .builder_row_cover::before';
153 if ( ! self::do_color_overlay( $row['styling'], $selector ) ) {
154 $breakpoints = themify_get_breakpoints();
155 foreach ($breakpoints as $bp => $v) {
156 if (!empty($row['styling']['breakpoint_' . $bp]) && self::do_color_overlay($row['styling']['breakpoint_' . $bp])) {
157 $hasOverlay = true;
158 break;
159 }
160 }
161 } else {
162 $hasOverlay = true;
163 }
164 // Background Slider
165 self::do_slider_background($row, $type);
166 $frames = array();
167 $framesCount = 0;
168 if (!empty($row['styling']['global_styles'])) {
169 $used_gs = Themify_Global_Styles::get_used_gs($builder_id);
170 if (!empty($used_gs)) {
171 $global_styles = explode(' ', $row['styling']['global_styles']);
172 if ($hasOverlay === false) {
173 $breakpoints = array('desktop' => '') + themify_get_breakpoints();
174 }
175 foreach ($global_styles as $cl) {
176 if (isset($used_gs[$cl])) {
177 if ($hasOverlay === false) {
178 foreach ($breakpoints as $bp => $v) {
179
180 if (($bp === 'desktop' && self::do_color_overlay($used_gs[$cl])) || ($bp !== 'desktop' && !empty($used_gs[$cl]['breakpoint_' . $bp]) && self::do_color_overlay($used_gs[$cl]['breakpoint_' . $bp]))) {
181 $hasOverlay = true;
182 break;
183 }
184 }
185 }
186 if ($framesCount !== 4) {
187 $frames = self::show_frame($used_gs[$cl], $frames);
188 $framesCount = count($frames);
189 }
190 }
191 if ($hasOverlay === true && $framesCount === 4) {
192 break;
193 }
194 }
195 }
196 }
197 if ($framesCount !== 4) {
198 self::show_frame($row['styling'], $frames);
199 }
200 if ($hasOverlay === true) {
201 Themify_Builder_Model::loadCssModules('cover', THEMIFY_BUILDER_CSS_MODULES . 'cover.css', THEMIFY_VERSION);
202 }
203 }
204 }
205
206 public static function clickable_component(array &$attr, array $settings) {
207 if (!empty($settings['_link'])) {
208 $classes = [];
209 $attr['data-tb_link'] = esc_url($settings['_link']);
210 if ( isset( $settings['_link_n'] ) ) {
211 if ( $settings['_link_n'] === 'yes' ) {
212 $attr['data-tb_link_new'] = '1';
213 } else if ( $settings['_link_n'] === 'lb' ) {
214 $attr['data-tb_link'] = add_query_arg( 'post_in_lightbox', 1, $attr['data-tb_link'] );
215 $attr['data-tb_lb'] = 1;
216 $settings = $settings + [
217 '_link_lw' => '',
218 '_link_lh' => '',
219 '_link_lw_unit' => 'px',
220 '_link_lh_unit' => 'px'
221 ];
222 if ( $settings['_link_lw'] !== '' || $settings['_link_lw'] !== '' ) {
223 $attr['data-zoom-config'] = $settings['_link_lw'] . $settings['_link_lw_unit'] . '|' . $settings['_link_lh'] . $settings['_link_lh_unit'];
224 }
225 }
226 }
227 if ( ! isset( $settings['_link_o'] ) || $settings['_link_o'] === 'no' ) {
228 $classes[] = 'tb_link_outline';
229 }
230 if ( ! empty( $classes ) ) {
231 if ( ! isset( $attr['class'] ) ) {
232 $attr['class'] = '';
233 }
234 $attr['class'] .= ' ' . implode( ' ', $classes );
235 }
236 themify_enque_style('tf_clickablecomponent', THEMIFY_BUILDER_CSS_MODULES . 'clickable-component.css', null, THEMIFY_VERSION);
237 }
238 }
239
240 public static function set_bg_mode(array &$attr, array $styling) {
241 $breakpoints = array('desktop' => '') + themify_get_breakpoints();
242 foreach ($breakpoints as $bp => $v) {
243 $bg = '';
244 if ($bp === 'desktop') {
245 if (isset($styling['background_repeat'])) {
246 $bg = $styling['background_repeat'];
247 }
248 } elseif (isset($styling['breakpoint_' . $bp]['background_repeat'])) {
249 $bg = $styling['breakpoint_' . $bp]['background_repeat'];
250 }
251 if ($bg === 'builder-parallax-scrolling' || $bg === 'builder-zoom-scrolling' || $bg === 'builder-zooming') {
252 $bg = explode('-', $bg);
253 $attr['data-' . $bg[1] . '-bg'] = $bp;
254 }
255 }
256 return $attr;
257 }
258
259 public static function get_responsive_cols(array $row) {
260 $cl = array();
261 $isFullpage = function_exists('themify_theme_is_fullpage_scroll') && themify_theme_is_fullpage_scroll();
262 if (!empty($row['sizes'])) {
263 $_arr = array('align', 'gutter', 'auto_h', 'dir');
264 foreach ($_arr as $k) {
265 if (!empty($row['sizes']['desktop_' . $k])) {
266 $v = $row['sizes']['desktop_' . $k];
267 if ($k === 'align') {
268 if ($v === 'center') {
269 $v = 'col_align_middle';
270 } elseif ($v === 'end') {
271 $v = 'col_align_bottom';
272 } else {
273 $v = 'col_align_top';
274 }
275 } elseif ($k === 'gutter') {
276 $v = $v === 'narrow' || $v === 'none' ? 'gutter-' . $v : '';
277 } elseif ($k === 'auto_h') {
278 $v = $v == '1' ? 'col_auto_height' : '';
279 } elseif ($k === 'dir') {
280 $v = $v === 'rtl' ? 'direction_rtl' : '';
281 }
282 if ($v !== '') {
283 $cl[] = $v;
284 }
285 } elseif ($k === 'align') {
286 $cl[] = $isFullpage === true ? 'col_align_middle' : 'col_align_top';
287 }
288 }
289 } else {
290 if (!empty($row['column_h'])) {
291 $cl[] = 'col_auto_height';
292 }
293 if (!empty($row['gutter']) && $row['gutter'] !== 'gutter-default') {
294 $cl[] = $row['gutter'];
295 }
296 if (isset($row['desktop_dir']) && $row['desktop_dir'] === 'rtl') {
297 $cl[] = 'direction_rtl';
298 }
299 $cl[] = !empty($row['column_alignment']) ? $row['column_alignment'] : ($isFullpage === true ? 'col_align_middle' : 'col_align_top');
300 }
301
302 $cl[] = 'tb_col_count_' . count($row['cols']);
303
304 return $cl;
305 }
306
307 /**
308 * Computes and returns the HTML for a background slider.
309 *
310 * @since 2.3.3
311 *
312 * @param array $row_or_col Row or column definition.
313 * @param string $order Order of row/column (e.g. 0 or 0-1-0-1 for sub columns)
314 * @param string $type Accepts 'row', 'col', 'sub-col'
315 *
316 * @return bool Returns false if $row_or_col doesn't have a bg slider. Otherwise outputs the HTML for the slider.
317 */
318 public static function do_slider_background(array $row_or_col, $type = 'row'):bool {
319 if (!isset($row_or_col['styling']['background_type']) || 'slider' !== $row_or_col['styling']['background_type'] || empty($row_or_col['styling']['background_slider'])) {
320 return false;
321 }
322 $images = themify_get_gallery_shortcode($row_or_col['styling']['background_slider']);
323 if (!empty($images)) :
324
325 $size = isset($row_or_col['styling']['background_slider_size']) ? $row_or_col['styling']['background_slider_size'] : false;
326 if (!$size) {
327 $size = themify_get_gallery_shortcode_params($row_or_col['styling']['background_slider'], 'size');
328 if (!$size) {
329 $size = 'large';
330 }
331 }
332 $bgmode = !empty($row_or_col['styling']['background_slider_mode']) ? $row_or_col['styling']['background_slider_mode'] : 'fullcover';
333 $slider_speed = !empty($row_or_col['styling']['background_slider_speed']) ? $row_or_col['styling']['background_slider_speed'] : '2000';
334 ?>
335 <span class="tf_hide <?php echo $type; ?>-slider tb_slider tf_abs" data-bgmode="<?php echo $bgmode; ?>" data-sliderspeed="<?php echo $slider_speed ?>">
336 <span class="tf_abs row-slider-slides tf_w tf_hidden tf_clearfix">
337 <?php
338 foreach ($images as $i => $img) {
339 $img_data = wp_get_attachment_image_src($img->ID, $size);
340 if (empty($img_data)) {
341 continue;
342 }
343 $alt = get_post_meta($img->ID, '_wp_attachment_image_alt', TRUE);
344 ?>
345 <span data-bg="<?php echo esc_url(themify_https_esc($img_data[0])); ?>"<?php if (!empty($alt)): ?> data-bg-alt="<?php esc_attr_e($alt); ?>"<?php endif; ?>>
346 <a href="javascript:;" rel="nofollow" class="row-slider-dot" data-index="<?php echo $i; ?>"><span class="screen-reader-text">&bull;</span></a>
347 </span>
348 <?php
349 }
350 ?>
351 </span>
352 <span class="row-slider-nav tf_abs_t tf_w">
353 <a href="javascript:;" rel="nofollow" class="row-slider-arrow row-slider-prev tf_hidden tf_abs_t"><span class="screen-reader-text">&larr;</span></a>
354 <a href="javascript:;" rel="nofollow" class="row-slider-arrow row-slider-next tf_hidden tf_abs_t"><span class="screen-reader-text">&rarr;</span></a>
355 </span>
356 </span>
357 <?php
358 return true;
359 endif; // images
360 return false;
361 }
362
363 /**
364 * Get template row
365 *
366 * @param array $row
367 * @param string $builder_id
368 * @param bool $echo
369 *
370 * @return string
371 */
372 public static function template(&$row, $builder_id, $echo = true, $tmp = -1) {//4 argument isn't used need for backward to avoid fatal error
373 if ($tmp === true || $tmp === false) {//map old data arguments
374 $row = $builder_id;
375 $builder_id = $echo;
376 $echo = $tmp;
377 }
378 $row = apply_filters('tf_builder_row', $row, $builder_id);
379 // prevent empty rows from being rendered
380 if (Themify_Builder::$frontedit_active === false || Themify_Builder::$is_loop === true) {
381 $count = isset($row['cols']) ? count($row['cols']) : 0;
382 if (($count === 0 && !isset($row['styling']) ) || ($count === 1 && empty($row['cols'][0]['modules']) && empty($row['cols'][0]['styling']) && empty($row['styling']) ) // there's only one column and it's empty
383 ) {
384 return '';
385 }
386 /* allow addons to control the display of the rows */
387 $display = apply_filters('themify_builder_row_display', true, $row, $builder_id);
388 if (false === $display || (isset($row['styling']['visibility_all']) && $row['styling']['visibility_all'] === 'hide_all' )) {
389 return '';
390 }
391 } else {
392 $count = 0;
393 }
394 $row_classes = array('module_row themify_builder_row');
395 $row_attributes = array();
396 $is_styling = !empty($row['styling']);
397 $video_data = '';
398 if ($is_styling === true) {
399 if (!isset($row['styling']['background_type']) && !empty($row['styling']['background_video'])) {
400 $row['styling']['background_type'] = 'video';
401 } elseif ((!isset($row['styling']['background_type']) || $row['styling']['background_type'] === 'image' ) && isset($row['styling']['background_zoom']) && $row['styling']['background_zoom'] === 'zoom' && $row['styling']['background_repeat'] === 'repeat-none') {
402 $row_classes[] = 'themify-bg-zoom';
403 }
404 $class_fields = array('custom_css_row', 'row_height');
405 foreach ($class_fields as $field) {
406 if (!empty($row['styling'][$field])) {
407 $row_classes[] = $row['styling'][$field];
408 }
409 }
410 unset($class_fields);
411 /**
412 * Row Width class
413 * To provide backward compatibility, the CSS classname and the option label do not match. See #5284
414 */
415 if (isset($row['styling']['row_width'])) {
416 if ('fullwidth' === $row['styling']['row_width']) {
417 $row_classes[] = 'fullwidth_row_container';
418 } elseif ('fullwidth-content' === $row['styling']['row_width']) {
419 $row_classes[] = 'fullwidth';
420 }
421 $breakpoints = themify_get_breakpoints('', true);
422 $breakpoints['desktop'] = 1;
423 $prop = 'fullwidth' === $row['styling']['row_width'] ? 'padding' : 'margin';
424 foreach ($breakpoints as $k => $v) {
425 $styles = $k === 'desktop' ? $row['styling'] : (!empty($row['styling']['breakpoint_' . $k]) ? $row['styling']['breakpoint_' . $k] : false);
426 if ($styles) {
427 $val = self::getDataValue($styles, $prop);
428 if ($val) {
429 $row_attributes['data-' . $k . '-' . $prop] = $val;
430 }
431 }
432 }
433 $breakpoints = null;
434 }
435 // background video
436 $video_data = self::get_video_background($row['styling']);
437 if ($video_data) {
438 $video_data = ' ' . $video_data;
439 } else {
440 self::set_bg_mode($row_attributes, $row['styling']);
441 }
442 // Class for Scroll Highlight
443 if (!empty($row['styling']['row_anchor']) && $row['styling']['row_anchor'] !== '#') {
444 $row_classes[] = 'tb_has_section';
445 $row_classes[] = 'tb_section-' . $row['styling']['row_anchor'];
446 $row_attributes['data-anchor'] = $row['styling']['row_anchor'];
447 }
448 // Disable change hashtag in URL
449 if (!empty($row['styling']['hide_anchor'])) {
450 $row_attributes['data-hide-anchor'] = $row['styling']['hide_anchor'];
451 }
452 if (!empty($row['styling']['global_styles'])) {
453 Themify_Global_Styles::add_class_to_components($row_classes, $row['styling'], $builder_id);
454 }
455 } else {
456 $row['styling'] = array();
457 }
458 if ($echo === false) {
459 $output = PHP_EOL; // add line break
460 ob_start();
461 }
462 if (Themify_Builder::$frontedit_active === false) {
463 $row_content_classes = $count > 0 ? self::get_responsive_cols($row) : array();
464 $row_content_classes = implode(' ', $row_content_classes);
465 if (isset($row['styling']['row_width']) && ('fullwidth' === $row['styling']['row_width'] || 'fullwidth-content' === $row['styling']['row_width'])) {
466 $row_attributes['data-css_id'] = $row['element_id'];
467 }
468 $row_classes[] = 'tb_' . $row['element_id'];
469 if ($is_styling === true) {
470 Themify_Builder_Component_Module::sticky_element_props($row_attributes, $row['styling']);
471 }
472 $row_attributes['data-lazy'] = 1;
473 if (self::$isFirstRow === false) {
474 self::$isFirstRow = true;
475 $row_classes[] = 'tb_first'; //need for lazy loadd, load first row bg image
476 } else {
477 self::$isFirstRow = null;
478 }
479 }
480 do_action('themify_builder_row_start', $builder_id, $row, '');
481 $row_classes[] = 'tf_w';
482 $row_attributes['class'] = implode(' ', apply_filters('themify_builder_row_classes', $row_classes, $row, $builder_id));
483 $row_classes = null;
484 self::clickable_component($row_attributes, $row['styling']);
485 $row_attributes = self::get_reveal_effect( $row['styling'], $row_attributes, 'row_reveal' );
486 $row_attributes = apply_filters('themify_builder_row_attributes', Themify_Builder_Component_Module::parse_animation_effect($row['styling'], $row_attributes), $row['styling'], $builder_id);
487 ?>
488 <?php if (strpos($row_attributes['class'], 'tb-page-break') !== false): ?>
489 <!-- tb_page_break -->
490 <?php endif; ?>
491 <div <?php echo themify_get_element_attributes($row_attributes), $video_data; ?>>
492 <?php
493 $row_attributes = $video_data = null;
494 if ($is_styling === true) {
495 do_action('themify_builder_background_styling', $builder_id, $row, 'row', '');
496 self::background_styling($row, 'row', $builder_id);
497 }
498 ?>
499 <div class="row_inner<?php if (Themify_Builder::$frontedit_active === false): ?> <?php echo $row_content_classes ?><?php endif; ?> tf_box tf_rel">
500 <?php
501 unset($row_content_classes);
502 if ($count > 0) {
503 if (isset($row['desktop_dir']) && $row['desktop_dir'] === 'rtl') {//backward compatibility
504 $row['cols'] = array_reverse($row['cols']);
505 }
506 foreach ($row['cols'] as $i => &$col) {
507 $cl = $i === 0 ? 'first' : ($i === ($count - 1) ? 'last' : null); //backward compatibility
508 Themify_Builder_Component_Column::template($col, $builder_id, true, false, $cl);
509 }
510 unset($col);
511 }
512 ?>
513 </div>
514 </div>
515 <?php
516 do_action('themify_builder_row_end', $builder_id, $row, '');
517 if ($echo === false) {
518 return PHP_EOL . ob_get_clean() . PHP_EOL;
519 }
520 }
521
522 private static function getDataValue(array $styles,string $type = 'padding'):string {
523 $value = '';
524 if (!empty($styles['checkbox_' . $type . '_apply_all']) && !empty($styles[$type . '_top'])) {
525 $value = $styles[$type . '_top'];
526 $value .= isset($styles[$type . '_top_unit']) ? $styles[$type . '_top_unit'] : 'px';
527 $value = $value . ',' . $value;
528 } elseif (!empty($styles[$type . '_left']) || !empty($styles[$type . '_right'])) {
529 if (!empty($styles[$type . '_left'])) {
530 $value = $styles[$type . '_left'];
531 $value .= isset($styles[$type . '_left_unit']) ? $styles[$type . '_left_unit'] : 'px';
532 }
533 if (!empty($styles[$type . '_right'])) {
534 $value .= ',' . $styles[$type . '_right'];
535 $value .= isset($styles[$type . '_right_unit']) ? $styles[$type . '_right_unit'] : 'px';
536 }
537 }
538 return $value;
539 }
540 }
541