/** * Function to get tab content for custom templates * * @since 2.0.0 * * @return String String having tab content */ public function get_custom_templates() { $columns = 6; //number of columns $content = '<div id="custom_templates_wrapper"> <div id="custom_templates_left"> <h1 class="templates_heading">' . __('Save Template', 'fusion-core') . '</h1> <div class="save_templates_here"> <a class="templates_selection" id="fusion_save_custom_tpl" href="JavaScript:void(0)">' . __('Save Layout As Template', 'fusion-core') . '</a> </div> </div> <div id="custom_templates_right"> <h1 class="templates_heading">' . __('Load Template', 'fusion-core') . '</h1>'; //get templates data $templates = get_option('fusion_custom_templates'); //if value exists and there are more than 1 number of templates if ($templates != false && count($templates) > 0) { //generate column combinations $combinations = FusionHelper::generate_column_combinations(count($templates), $columns); //add data in each column for ($i = 0; $i < $columns; $i++) { //if no data available for this column then break if ($combinations[$i] == 0) { break; } $counter = 0; $content .= ' <div class="custom_templates_sections">'; foreach ($templates as $key => $value) { $content .= ' <div style="position:relative;" class="template_selection_wrapper"> '; $content .= ' <div class="hidden_overlay"> <a href="JavaScript:void(0)" data-id="' . $key . '" class="fuiosn_load_template">' . __('LOAD', 'fusion-core') . '</a> <a href="JavaScript:void(0)" data-id="' . $key . '" class="fusion_delete_template">' . __('DELETE', 'fusion-core') . '</a> </div>'; $content .= ' <a class="fusion_custom_template templates_selection" href="JavaScript:void(0)">' . $key . '</a>'; $content .= ' </div>'; //remove current element from array for next iteration unset($templates[$key]); $counter++; //if reached combination value then break loop if ($counter == $combinations[$i]) { break; } } $content .= '</div>'; } } $content .= '</div>'; return $content; }
/** * Function to get tab content for pre-built templates * * @since 2.0.0 * * @return String String having tab content */ public function get_prebuilt_templates() { $columns = 6; //number of columns $content = '<div id="pre_built_templates_wrapper"><div id="custom_templates_right" class="custom_pre_built">'; //get templates data $templates = unserialize(base64_decode(self::$content)); //if value exists and there are more than 1 number of templates if ($templates != false && count($templates) > 0) { //generate column combinations $combinations = FusionHelper::generate_column_combinations(count($templates), $columns); //add data in each column for ($i = 0; $i < $columns; $i++) { //if no data available for this column then break if ($combinations[$i] == 0) { break; } $counter = 0; $content .= ' <div class="pre_built_templates_section">'; foreach ($templates as $key => $value) { $content .= ' <div class="template_selection_wrapper"> '; $content .= ' <a class="fusion_pre_built_template templates_selection" data-id="' . $key . '" '; $content .= ' href="JavaScript:void(0)">' . $key . '</a>'; $content .= ' </div>'; //remove current element from array for next iteration unset($templates[$key]); $counter++; //if reached combination value then break loop if ($counter == $combinations[$i]) { break; } } $content .= '</div>'; } } $content .= '</div></div>'; return $content; }