/** * preventNested * * Display a warning on post edit pages when: * - Beaver Builder is active on that post * - The post is using a Content Template that also has Beaver Builder active * * @param $post WP_Post object * * @since 2.2 */ public function preventNested($post) { $beaver_post_types = FLBuilderModel::get_post_types(); if (in_array($post->post_type, $beaver_post_types)) { $post_has_ct = get_post_meta($post->ID, '_views_template', true); $ct_has_beaver = false; if ($post_has_ct) { $ct_has_beaver = get_post_meta($post_has_ct, '_fl_builder_enabled', true); } $post_has_beaver = get_post_meta($post->ID, '_fl_builder_enabled', true); if ($ct_has_beaver && $post_has_beaver) { $post_type_object = get_post_type_object($post->post_type); $ct_title = get_the_title($post_has_ct); ?> <div class="toolset-alert toolset-alert-error"> <p><strong><?php echo sprintf(__('%1$s %2$s design inside %2$s templates may cause problems', 'wpv-views'), '<i class="fa fa-exclamation-triangle fa-lg" aria-hidden="true"></i>', $this->editor->getName(), $this->editor->getName()); ?> </strong></p> <p> <?php echo sprintf(__('You are using %1$s to design this page, but there is already a template <em>%2$s</em> created by %3$s for %4$s. This may work, but could produce visual glitches. Please consider using %5$s only for the template OR for this page.', 'wpv-views'), $this->editor->getName(), $ct_title, $this->editor->getName(), '<em>' . $post_type_object->labels->name . '</em>', $this->editor->getName()); ?> </p> <p> <?php echo sprintf(__('%1$sDesigning templates with %2$s%3$s.', 'wpv-views'), '<a href="#" target="_blank">', $this->editor->getName(), '</a>'); ?> </p> </div> <?php } } }
<?php } else { ?> <p><?php _e('Select the post types you would like the builder to work with.', 'fl-builder'); ?> </p> <p><?php _e('NOTE: Not all custom post types may be supported.', 'fl-builder'); ?> </p> <?php $saved_post_types = FLBuilderModel::get_post_types(); $post_types = get_post_types(array('public' => true), 'objects'); $post_types = apply_filters('fl_builder_admin_settings_post_types', $post_types); foreach ($post_types as $post_type) { $checked = in_array($post_type->name, $saved_post_types) ? 'checked' : ''; if ($post_type->name == 'attachment') { continue; } if ($post_type->name == 'fl-builder-template') { continue; } ?> <p> <label> <input type="checkbox" name="fl-post-types[]" value="<?php echo $post_type->name;
/** * 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; }