/** * Renders the markup for the builder interface. * * @since 1.0 * @return void */ public static function render_ui() { global $wp_the_query; if (FLBuilderModel::is_builder_active()) { $post_id = $wp_the_query->post->ID; $help_button = FLBuilderModel::get_help_button_settings(); $enabled_templates = FLBuilderModel::get_enabled_templates(); $color_presets = FLBuilderModel::get_color_presets(); $simple_ui = !current_user_can(FLBuilderModel::get_editing_capability()); $categories = FLBuilderModel::get_categorized_modules(); $row_templates = null; $module_templates = null; if (!FLBuilderModel::is_post_user_template('module') && !$simple_ui) { if (class_exists('FLBuilderTemplatesOverride')) { if (FLBuilderTemplatesOverride::show_modules()) { $module_templates = FLBuilderTemplatesOverride::get_selector_data('module'); } if (FLBuilderTemplatesOverride::show_rows() && !FLBuilderModel::is_post_user_template('row')) { $row_templates = FLBuilderTemplatesOverride::get_selector_data('row'); } } include FL_BUILDER_DIR . 'includes/ui-panel.php'; } include FL_BUILDER_DIR . 'includes/ui-bar.php'; include FL_BUILDER_DIR . 'includes/ui-fields.php'; include FL_BUILDER_DIR . 'includes/ui-js-templates.php'; include FL_BUILDER_DIR . 'includes/ui-js-config.php'; } }
/** * Returns template data needed for the template selector. * * @since 1.5.7 * @return array */ public static function get_template_selector_data() { // Return data for overriding core templates? if (class_exists('FLBuilderTemplatesOverride')) { $data = FLBuilderTemplatesOverride::get_selector_data(); if ($data) { return $data; } } // Return data for core templates. $category_labels = array('landing' => __('Home Pages', 'fl-builder'), 'company' => __('Content Pages', 'fl-builder')); $categorized = array(); $templates = array(); foreach (self::get_templates() as $key => $template) { $templates[] = array('id' => $key, 'name' => $template->name, 'image' => FL_BUILDER_URL . 'img/templates/' . $template->image, 'category' => $template->category); } foreach ($templates as $template) { if (!isset($categorized[$template['category']])) { $categorized[$template['category']] = array('name' => $category_labels[$template['category']], 'templates' => array()); } $categorized[$template['category']]['templates'][] = $template; } return array('templates' => $templates, 'categorized' => $categorized); }