PluginProbe
Themify Builder / trunk
Themify Builder vtrunk
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 / column.php

column.php in Themify Builder trunk, at includes/components/column.php

85 lines 3.5 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_Column{
5
6 /**
7 * Get template column.
8 *
9 * @param array $col
10 * @param string $builder_id
11 * @param boolean $echo
12 */
13 public static function template(array &$col, $builder_id,bool $echo = true,bool $is_SubCol = false, $cl = null) {
14 $print_column_classes = array('module_column');
15 $print_column_classes[] = $is_SubCol === false ? 'tb-column' : 'sub_column';
16 if (isset($col['grid_class'])) {
17 $print_column_classes[] = strtr($col['grid_class'], array('first' => '', 'last' => ''));
18 }
19 $column_tag_attrs = array();
20 $is_styling = !empty($col['styling']);
21 $video_data = '';
22 if (Themify_Builder::$frontedit_active === false) {
23 $print_column_classes[] = 'tb_' . $col['element_id'];
24 $column_tag_attrs['data-lazy'] = 1;
25 }
26 if ($is_styling === true) {
27 if (!empty($col['styling']['global_styles'])) {
28 Themify_Global_Styles::add_class_to_components($print_column_classes, $col['styling'], $builder_id);
29 }
30 if (isset($col['styling']['background_type'], $col['styling']['background_zoom']) && $col['styling']['background_type'] === 'image' && $col['styling']['background_zoom'] === 'zoom' && $col['styling']['background_repeat'] === 'repeat-none') {
31 $print_column_classes[] = 'themify-bg-zoom';
32 }
33 if (!empty($col['styling']['custom_css_column'])) {
34 $print_column_classes[] = themify_sanitize_css_classes( $col['styling']['custom_css_column'] );
35 }
36 // background video
37 $video_data = Themify_Builder_Component_Row::get_video_background($col['styling']);
38 if ($video_data) {
39 $video_data = ' ' . $video_data;
40 } else {
41 Themify_Builder_Component_Row::set_bg_mode($column_tag_attrs, $col['styling']);
42 }
43 }
44 if ($cl !== null) {
45 $print_column_classes[] = $cl;
46 }
47 $column_tag_attrs['class'] = implode(' ', $print_column_classes);
48 if ($is_styling === true) {
49 Themify_Builder_Component_Row::clickable_component($column_tag_attrs,$col['styling']);
50 }
51 unset($print_column_classes);
52 if ($echo === false) {
53 ob_start();
54 }
55 // Start Column Render ######
56 ?>
57 <div <?php echo themify_get_element_attributes($column_tag_attrs), $video_data; ?>>
58 <?php
59 $column_tag_attrs = $video_data = null;
60 if ($is_styling === true) {
61 do_action('themify_builder_background_styling', $builder_id, $col, 'column', '');
62 Themify_Builder_Component_Row::background_styling($col, 'column', $builder_id);
63 }
64 ?>
65 <?php if (!empty($col['modules'])){
66 foreach ($col['modules'] as &$mod) {
67 if (isset($mod['mod_name'])) {
68 Themify_Builder_Component_Module::template($mod, $builder_id);
69 }
70 if (!empty($mod['cols'])) {// Check for Sub-rows
71 Themify_Builder_Component_SubRow::template($mod, $builder_id);
72 }
73 }
74 unset($mod);
75 } ?>
76 </div>
77 <?php
78 // End Column Render ######
79
80 if ($echo === false) {
81 return PHP_EOL . ob_get_clean() . PHP_EOL;
82 }
83 }
84 }
85