From b3270f97435db5e07d844371a8540d2bef754e9d Mon Sep 17 00:00:00 2001 From: Kader Ibrahim S Date: Mon, 9 Sep 2024 18:56:55 +0530 Subject: [PATCH] Removes WooCommerce navigation items (#2800) * Removes WooCommerce navigation code * Removes Navigation class import --- includes/Admin/Settings.php | 59 ++++--------------------------------- 1 file changed, 6 insertions(+), 53 deletions(-) diff --git a/includes/Admin/Settings.php b/includes/Admin/Settings.php index efab52afc..981578673 100644 --- a/includes/Admin/Settings.php +++ b/includes/Admin/Settings.php @@ -11,7 +11,6 @@ namespace WooCommerce\Facebook\Admin; use Automattic\WooCommerce\Admin\Features\Features as WooAdminFeatures; -use Automattic\WooCommerce\Admin\Features\Navigation\Menu as WooAdminMenu; use WooCommerce\Facebook\Admin\Settings_Screens; use WooCommerce\Facebook\Admin\Settings_Screens\Connection; use WooCommerce\Facebook\Framework\Helper; @@ -40,13 +39,6 @@ class Settings { /** @var Abstract_Settings_Screen[] */ private $screens; - /** - * Whether the new Woo nav should be used. - * - * @var bool - */ - public $use_woo_nav; - /** * Settings constructor. * @@ -91,9 +83,7 @@ private function build_menu_item_array( bool $is_connected ): array { public function add_menu_item() { $root_menu_item = 'woocommerce'; $is_marketing_enabled = false; - $this->use_woo_nav = class_exists( WooAdminFeatures::class ) - && class_exists( WooAdminMenu::class ) - && WooAdminFeatures::is_enabled( 'navigation' ); + if ( Compatibility::is_enhanced_admin_available() ) { if ( class_exists( WooAdminFeatures::class ) ) { $is_marketing_enabled = WooAdminFeatures::is_enabled( 'marketing' ); @@ -115,7 +105,6 @@ public function add_menu_item() { 5 ); $this->connect_to_enhanced_admin( $is_marketing_enabled ? 'marketing_page_wc-facebook' : 'woocommerce_page_wc-facebook' ); - $this->register_woo_nav_menu_items(); if ( $is_marketing_enabled ) { $this->add_fb_product_sets_to_marketing_menu(); @@ -218,13 +207,11 @@ public function render() { $screen = $this->get_screen( $current_tab ); ?>
- use_woo_nav ) : ?> - - + get_message_handler()->show_messages(); ?>

get_title() ); ?>

@@ -333,38 +320,4 @@ public function get_tabs() { */ return (array) apply_filters( 'wc_facebook_admin_settings_tabs', $tabs, $this ); } - - /** - * Register nav items for new Woo nav. - * - * @since 2.3.3 - */ - private function register_woo_nav_menu_items() { - if ( ! $this->use_woo_nav ) { - return; - } - WooAdminMenu::add_plugin_category( - array( - 'id' => 'facebook-for-woocommerce', - 'title' => __( 'Facebook', 'facebook-for-woocommerce' ), - 'capability' => 'manage_woocommerce', - ) - ); - $order = 1; - foreach ( $this->get_screens() as $screen_id => $screen ) { - $url = $screen instanceof Settings_Screens\Product_Sets - ? 'edit-tags.php?taxonomy=fb_product_set&post_type=product' - : 'wc-facebook&tab=' . $screen->get_id(); - WooAdminMenu::add_plugin_item( - array( - 'id' => 'facebook-for-woocommerce-' . $screen->get_id(), - 'parent' => 'facebook-for-woocommerce', - 'title' => $screen->get_label(), - 'url' => $url, - 'order' => $order, - ) - ); - ++$order; - } - } }