From c78aa35cfeeee44872e0f107e9065bbcebb17b97 Mon Sep 17 00:00:00 2001
From: Justin Palmer <228780+layoutd@users.noreply.github.com>
Date: Sun, 27 Oct 2024 00:44:54 +0200
Subject: [PATCH 1/4] Remove extra .
---
class-wc-facebookcommerce.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/class-wc-facebookcommerce.php b/class-wc-facebookcommerce.php
index b9a26c9c0..119b63133 100644
--- a/class-wc-facebookcommerce.php
+++ b/class-wc-facebookcommerce.php
@@ -392,7 +392,7 @@ public function register_custom_taxonomy() {
// translators: No items found text
'not_found' => sprintf( esc_html__( 'No %s found.', 'facebook-for-woocommerce' ), $plural ),
// translators: Search label
- 'search_items' => sprintf( esc_html__( 'Search %s.', 'facebook-for-woocommerce' ), $plural ),
+ 'search_items' => sprintf( esc_html__( 'Search %s', 'facebook-for-woocommerce' ), $plural ),
// translators: Text label
'separate_items_with_commas' => sprintf( esc_html__( 'Separate %s with commas', 'facebook-for-woocommerce' ), $plural ),
// translators: Text label
From 46dd503a9904e9584d9c7bdcf56576191a497929 Mon Sep 17 00:00:00 2001
From: Justin Palmer <228780+layoutd@users.noreply.github.com>
Date: Sun, 27 Oct 2024 00:50:36 +0200
Subject: [PATCH 2/4] Show the nav tabs in product sets
---
includes/Admin/Settings.php | 116 ++++++++++++++++++++++++++++++++----
1 file changed, 105 insertions(+), 11 deletions(-)
diff --git a/includes/Admin/Settings.php b/includes/Admin/Settings.php
index 35c62e87c..bbeb5ffd5 100644
--- a/includes/Admin/Settings.php
+++ b/includes/Admin/Settings.php
@@ -52,6 +52,8 @@ public function __construct( bool $is_connected ) {
add_action( 'admin_menu', array( $this, 'add_menu_item' ) );
add_action( 'wp_loaded', array( $this, 'save' ) );
add_filter( 'parent_file', array( $this, 'set_parent_and_submenu_file' ) );
+
+ add_action( 'admin_head', array( $this, 'add_tabs_to_product_sets_taxonomy' ) );
}
/**
@@ -191,19 +193,11 @@ private function connect_to_enhanced_admin( $screen_id ) {
* @since 2.0.0
*/
public function render() {
- $tabs = $this->get_tabs();
- $current_tab = Helper::get_requested_value( 'tab' );
- if ( ! $current_tab ) {
- $current_tab = current( array_keys( $tabs ) );
- }
- $screen = $this->get_screen( $current_tab );
+ $current_tab = $this->get_current_tab();
+ $screen = $this->get_screen( $current_tab );
?>
-
+ render_tabs( $current_tab ); ?>
get_message_handler()->show_messages(); ?>
get_title() ); ?>
@@ -214,6 +208,40 @@ public function render() {
get_tabs();
+ ?>
+
+ get_tabs();
+ $current_tab = Helper::get_requested_value( 'tab' );
+ if ( ! $current_tab ) {
+ $current_tab = current( array_keys( $tabs ) );
+ }
+ return $current_tab;
+ }
+
/**
* Saves the settings page.
@@ -312,4 +340,70 @@ public function get_tabs() {
*/
return (array) apply_filters( 'wc_facebook_admin_settings_tabs', $tabs, $this );
}
+
+ /**
+ * Add the Facebook for WooCommerce tabs to the Facebook Product Set taxonomy page.
+ * Renders the tabs (hidden by default) at the stop of the page,
+ * then moves them to the correct DOM location with JavaScript and displays them.
+ *
+ * @since 3.3.0
+ */
+ public function add_tabs_to_product_sets_taxonomy() {
+ // Only load this on the edit-tags.php page
+ $screen = get_current_screen();
+ $is_taxonomy_list_page = 'edit-tags' === $screen->base;
+ $is_taxonomy_term_page = 'term' === $screen->base;
+ $is_taxonomy_page = $is_taxonomy_list_page || $is_taxonomy_term_page;
+ $is_product_set_taxonomy = 'fb_product_set' === $screen->taxonomy && $is_taxonomy_page;
+
+ if ( $is_product_set_taxonomy ) {
+ $this->render_tabs( Settings_Screens\Product_Sets::ID );
+ ?>
+
+
+
Date: Thu, 31 Oct 2024 11:10:14 +0100
Subject: [PATCH 3/4] Remove leftover comment
---
includes/Admin/Settings.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/includes/Admin/Settings.php b/includes/Admin/Settings.php
index bbeb5ffd5..fdb1da11e 100644
--- a/includes/Admin/Settings.php
+++ b/includes/Admin/Settings.php
@@ -391,7 +391,6 @@ public function add_tabs_to_product_sets_taxonomy() {
if (tabs) {
let wpbody = document.querySelector('#wpbody-content > .wrap');
if (wpbody) {
- // wpbody.querySelector('h1').remove();
// move tabs to the top of wpbody
wpbody.insertBefore(tabs, wpbody.firstChild);
tabs.style.display = 'block';
From ea089fa7f9cd0f4a18fd715099ee0795ddb69bd3 Mon Sep 17 00:00:00 2001
From: Justin Palmer <228780+layoutd@users.noreply.github.com>
Date: Thu, 31 Oct 2024 11:37:50 +0100
Subject: [PATCH 4/4] Use all_admin_notices
---
includes/Admin/Settings.php | 49 +++++++++++--------------------------
1 file changed, 14 insertions(+), 35 deletions(-)
diff --git a/includes/Admin/Settings.php b/includes/Admin/Settings.php
index fdb1da11e..2b3f48695 100644
--- a/includes/Admin/Settings.php
+++ b/includes/Admin/Settings.php
@@ -14,7 +14,6 @@
use WooCommerce\Facebook\Admin\Settings_Screens;
use WooCommerce\Facebook\Admin\Settings_Screens\Connection;
use WooCommerce\Facebook\Framework\Helper;
-use WooCommerce\Facebook\Framework\Plugin\Compatibility;
use WooCommerce\Facebook\Framework\Plugin\Exception as PluginException;
defined( 'ABSPATH' ) || exit;
@@ -53,7 +52,7 @@ public function __construct( bool $is_connected ) {
add_action( 'wp_loaded', array( $this, 'save' ) );
add_filter( 'parent_file', array( $this, 'set_parent_and_submenu_file' ) );
- add_action( 'admin_head', array( $this, 'add_tabs_to_product_sets_taxonomy' ) );
+ add_action( 'all_admin_notices', array( $this, 'add_tabs_to_product_sets_taxonomy' ) );
}
/**
@@ -349,6 +348,7 @@ public function get_tabs() {
* @since 3.3.0
*/
public function add_tabs_to_product_sets_taxonomy() {
+
// Only load this on the edit-tags.php page
$screen = get_current_screen();
$is_taxonomy_list_page = 'edit-tags' === $screen->base;
@@ -361,48 +361,27 @@ public function add_tabs_to_product_sets_taxonomy() {
?>
-
-