/** * Get template for module * @param $mod * @param bool $echo * @param bool $wrap * @param null $class * @param array $identifier * @return bool|string */ function get_template_module($mod, $builder_id = 0, $echo = true, $wrap = true, $class = null, $identifier = array()) { /* allow addons to control the display of the modules */ $display = apply_filters('themify_builder_module_display', true, $mod, $builder_id, $identifier); if (false === $display) { return false; } $output = ''; $mod['mod_name'] = isset($mod['mod_name']) ? $mod['mod_name'] : ''; $mod['mod_settings'] = isset($mod['mod_settings']) ? $mod['mod_settings'] : array(); $mod_id = $mod['mod_name'] . '-' . $builder_id . '-' . implode('-', $identifier); $output .= PHP_EOL; // add line break // check whether module active or not if (!Themify_Builder_Model::check_module_active($mod['mod_name'])) { return false; } if ($wrap) { ob_start(); ?> <div class="themify_builder_module_front clearfix module-<?php echo esc_attr($mod['mod_name']); ?> active_module <?php echo esc_attr($class); ?> " data-module-name="<?php echo esc_attr($mod['mod_name']); ?> "> <div class="themify_builder_module_front_overlay"></div> <?php themify_builder_edit_module_panel($mod['mod_name'], $mod['mod_settings']); $output .= ob_get_clean(); } $module_args = apply_filters('themify_builder_module_args', array('before_title' => '<h3 class="module-title">', 'after_title' => '</h3>')); $mod['mod_settings'] = wp_parse_args($mod['mod_settings'], $module_args); $output .= $this->retrieve_template('template-' . $mod['mod_name'] . '.php', array('module_ID' => $mod_id, 'mod_name' => $mod['mod_name'], 'builder_id' => $builder_id, 'mod_settings' => isset($mod['mod_settings']) ? $mod['mod_settings'] : ''), '', '', false); $style_id = '.themify_builder .' . $mod_id; if (Themify_Builder_Model::is_frontend_editor_page() || isset($_GET['themify_builder_infinite_scroll']) && 'yes' == $_GET['themify_builder_infinite_scroll'] || $this->is_front_end_style_inline) { $output .= $this->get_custom_styling($style_id, $mod['mod_name'], $mod['mod_settings']); } if ($wrap) { $output .= '</div>'; } // add line break $output .= PHP_EOL; if ($echo) { echo $output; } else { return $output; } }
/** * Get template for module * @param $mod * @param bool $echo * @param bool $wrap * @param null $class * @param array $identifier * @return bool|string */ function get_template_module($mod, $builder_id = 0, $echo = true, $wrap = true, $class = null, $identifier = array()) { $output = ''; $mod['mod_name'] = isset($mod['mod_name']) ? $mod['mod_name'] : ''; $mod['mod_settings'] = isset($mod['mod_settings']) ? $mod['mod_settings'] : array(); $mod_id = $mod['mod_name'] . '-' . $builder_id . '-' . implode('-', $identifier); $output .= PHP_EOL; // add line break // check whether module active or not if (!$this->check_module_active($mod['mod_name'])) { return false; } if ($wrap) { ob_start(); ?> <div class="themify_builder_module_front clearfix module-<?php echo esc_attr($mod['mod_name']); ?> active_module <?php echo $class; ?> " data-module-name="<?php echo esc_attr($mod['mod_name']); ?> "> <div class="themify_builder_module_front_overlay"></div> <?php themify_builder_edit_module_panel($mod['mod_name'], $mod['mod_settings']); ?> <?php $output .= ob_get_clean(); } $output .= $this->retrieve_template('template-' . $mod['mod_name'] . '.php', array('module_ID' => $mod_id, 'mod_name' => $mod['mod_name'], 'mod_settings' => isset($mod['mod_settings']) ? $mod['mod_settings'] : ''), '', '', false); if ($wrap) { $output .= '</div>'; } // add line break $output .= PHP_EOL; if ($echo) { echo $output; } else { return $output; } }