From 0f5145904138331f61ae69b542d34e0b961636e9 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Sun, 26 Mar 2023 06:39:52 +0100 Subject: [PATCH 1/2] makes snackbar unique and adds icon --- src/components/SubmitControls.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/SubmitControls.tsx b/src/components/SubmitControls.tsx index 2ffb594..b8e403d 100644 --- a/src/components/SubmitControls.tsx +++ b/src/components/SubmitControls.tsx @@ -49,8 +49,10 @@ const SubmitControls = ({ setIsSaving(false); - dispatch('core/notices').createSuccessNotice('✅ Saved successfully!', { + dispatch('core/notices').createSuccessNotice('Saved successfully!', { type: 'snackbar', + id: 'mr-feature-flags-snackbar', + icon: <>✅, }); }; return ( From 2ecdc759a9635dbaf68b557d8799cb61b1f1df60 Mon Sep 17 00:00:00 2001 From: Mohan Raj Date: Sun, 26 Mar 2023 07:21:09 +0100 Subject: [PATCH 2/2] adds uninstall hook --- plugin.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/plugin.php b/plugin.php index 2a9b41a..4ae63b8 100644 --- a/plugin.php +++ b/plugin.php @@ -32,8 +32,7 @@ */ define( 'MR_FEATURE_FLAGS_PLUGIN_PATH', __FILE__ ); - -if ( ! file_exists( FeatureFlags::class ) ) { +if ( ! file_exists( Utils::class ) ) { include_once __DIR__ . '/vendor/autoload.php'; } @@ -52,7 +51,7 @@ function(): void { ); - $feature_flag_meta = get_option( FeatureFlags::$option_name ); + $feature_flag_meta = get_option( Utils::$option_name ); $flags_list = []; if ( is_array( $feature_flag_meta ) ) { $flags_list = $feature_flag_meta; @@ -149,7 +148,7 @@ function( string $page ): void { add_filter( 'plugin_action_links_mr-feature-flags/plugin.php', - function ( $links ) { + function ( $links ) { $url = esc_url( add_query_arg( 'page', @@ -167,3 +166,14 @@ function ( $links ) { return $links; } ); + +register_deactivation_hook( __FILE__, __NAMESPACE__ . '\mr_feature_flags_uninstall' ); + +/** + * Uninstall method for the plugin. + */ +function mr_feature_flags_uninstall() { + delete_option( Utils::$option_name ); +} + +