function get_items($request) { $templates = array(); $user_templates = get_posts(array('post_type' => 'fl-builder-template', 'orderby' => 'menu_order title', 'order' => 'ASC', 'posts_per_page' => -1, 'fl-builder-template-type' => 'layout')); //$user_templates = FLBuilderModel::get_user_templates(); if (!empty($user_templates)) { foreach ($user_templates as $post) { $layout = get_post_meta($post->ID, '_fl_builder_data', true); if ($layout) { $categories = get_post_meta($post->ID, 'template_categories', true); if (empty($categories)) { $categories = array('saved'); } $templates[] = array('handle' => $post->ID, 'label' => $post->post_title, 'description' => $post->post_excerpt, 'author' => $post->post_author, 'modified' => $post->post_modified, 'edit_link' => FLBuilderModel::get_edit_url($post->ID), 'categories' => $categories, 'type' => 'user', 'is_global' => get_post_meta($post->ID, '_fl_builder_template_global', true), 'is_editable' => true); } } } $template_data = FLBuilderModel::get_templates(); if (!empty($template_data)) { foreach ($template_data as $data) { $templates[] = array('handle' => $data->index, 'label' => $data->name, 'screenshot' => array('thumbnail' => FL_BUILDER_URL . 'img/templates/' . $data->image), 'author' => array('name' => 'Beaver Builder Team'), 'categories' => array($data->category), 'is_premium' => $data->premium, 'is_builtin' => true, 'type' => 'core'); } } $response = rest_ensure_response($templates); return $response; }
/** * Adds the page builder button to the WordPress admin bar. * * @since 1.0 * @param object $wp_admin_bar An instance of the WordPress admin bar. * @return void */ public static function admin_bar_menu($wp_admin_bar) { global $wp_the_query; if (FLBuilderModel::is_post_editable()) { $wp_admin_bar->add_node(array('id' => 'fl-builder-frontend-edit-link', 'title' => '<style> #wp-admin-bar-fl-builder-frontend-edit-link .ab-icon:before { content: "\\f116" !important; top: 2px; margin-right: 3px; } </style><span class="ab-icon"></span>' . FLBuilderModel::get_branding(), 'href' => FLBuilderModel::get_edit_url($wp_the_query->post->ID))); } }
/** * Renders the action link for post listing pages. * * @since 1.0 * @param array $actions * @return array The array of action data. */ public static function render_row_actions_link($actions = array()) { global $post; if (current_user_can('edit_post', $post->ID) && wp_check_post_lock($post->ID) === false) { $post_types = FLBuilderModel::get_post_types(); if (in_array($post->post_type, $post_types)) { $actions['fl-builder'] = '<a href="' . FLBuilderModel::get_edit_url() . '">' . FLBuilderModel::get_branding() . '</a>'; } } return $actions; }
/** * Filter the edit link * * @since 0.3 * @param string $url * @param int $post_id * @param string $context * @return string $url The Url to an edit screen */ static function filter_edit_post_link($url, $post_id, $context) { if (get_post_type($post_id) == 'brj-workspace') { $url = FLBuilderModel::get_edit_url($post_id); } return $url; }
if ($enabled) { echo ' fl-active'; } ?> "><?php echo FLBuilderModel::get_branding(); ?> </a> </div> <div class="fl-builder-admin-ui"> <h3><?php printf(_x('%s is currently active for this %s.', 'The first %s stands for custom branded "Page Builder" name. The second %s stands for the post type name.', 'fl-builder'), FLBuilderModel::get_branding(), $post_type_name); ?> </h3> <a href="<?php echo FLBuilderModel::get_edit_url(); ?> " class="fl-launch-builder button button-primary button-large"><?php printf(_x('Launch %s', '%s stands for custom branded "Page Builder" name.', 'fl-builder'), FLBuilderModel::get_branding()); ?> </a> </div> <div class="fl-builder-loading"></div> </div> <script type="text/javascript"> FLBuilderAdminPostsStrings = { switchToEditor: '<?php printf(esc_attr_x('Switching to Text Editor mode will disable your %s layout until it is enabled again. Any edits made while in Text Editor mode will not be made on your %s layout. Do you want to continue?', '%s stands for custom branded "Page Builder" name.', 'fl-builder'), FLBuilderModel::get_branding(), FLBuilderModel::get_branding()); ?> '