From 1fbc89c87b845408ef40e24acd4c45681559ec7e Mon Sep 17 00:00:00 2001 From: Geoff Dusome Date: Mon, 16 Dec 2024 14:08:08 -0500 Subject: [PATCH 1/2] [MOOSE-175]: disable font library UI --- .../core/src/Theme_Config/Block_Editor.php | 16 ++++++++++++++++ .../src/Theme_Config/Theme_Config_Subscriber.php | 5 +++++ 2 files changed, 21 insertions(+) create mode 100644 wp-content/plugins/core/src/Theme_Config/Block_Editor.php diff --git a/wp-content/plugins/core/src/Theme_Config/Block_Editor.php b/wp-content/plugins/core/src/Theme_Config/Block_Editor.php new file mode 100644 index 00000000..a3e20504 --- /dev/null +++ b/wp-content/plugins/core/src/Theme_Config/Block_Editor.php @@ -0,0 +1,16 @@ +container->get( Block_Editor::class )->disable_font_library_ui( $settings ); + } ); + // Remove comments page in menu add_action( 'admin_menu', function (): void { $this->container->get( Comment_Support::class )->remove_comments_menu_item(); From 64d510f3e3d6218ed4d675290677ed8711fd39fb Mon Sep 17 00:00:00 2001 From: Geoff Dusome Date: Mon, 16 Dec 2024 16:22:51 -0500 Subject: [PATCH 2/2] [MOOSE-175]: move settings to not split locations --- .../core/src/Blocks/Blocks_Subscriber.php | 10 ++++++++-- .../core/src/Theme_Config/Block_Editor.php | 16 ---------------- .../src/Theme_Config/Theme_Config_Subscriber.php | 5 ----- .../core/src/Theme_Config/Theme_Support.php | 9 +++++++++ 4 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 wp-content/plugins/core/src/Theme_Config/Block_Editor.php diff --git a/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php b/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php index 7354860c..702f06c7 100644 --- a/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php +++ b/wp-content/plugins/core/src/Blocks/Blocks_Subscriber.php @@ -102,10 +102,16 @@ public function register(): void { add_filter( 'should_load_remote_block_patterns', '__return_false' ); /** - * Disable openverse media category. + * Handle Block Editor Settings */ add_filter( 'block_editor_settings_all', function ( array $settings ): array { - return $this->container->get( Theme_Support::class )->disable_openverse_media_category( $settings ); + // Disable openverse media category. + $settings = $this->container->get( Theme_Support::class )->disable_openverse_media_category( $settings ); + + // Disable the WP block editor font library. + $settings = $this->container->get( Theme_Support::class )->disable_font_library_ui( $settings ); + + return $settings; } ); } diff --git a/wp-content/plugins/core/src/Theme_Config/Block_Editor.php b/wp-content/plugins/core/src/Theme_Config/Block_Editor.php deleted file mode 100644 index a3e20504..00000000 --- a/wp-content/plugins/core/src/Theme_Config/Block_Editor.php +++ /dev/null @@ -1,16 +0,0 @@ -container->get( Block_Editor::class )->disable_font_library_ui( $settings ); - } ); - // Remove comments page in menu add_action( 'admin_menu', function (): void { $this->container->get( Comment_Support::class )->remove_comments_menu_item(); diff --git a/wp-content/plugins/core/src/Theme_Config/Theme_Support.php b/wp-content/plugins/core/src/Theme_Config/Theme_Support.php index 93ee09f8..b56ce5c9 100644 --- a/wp-content/plugins/core/src/Theme_Config/Theme_Support.php +++ b/wp-content/plugins/core/src/Theme_Config/Theme_Support.php @@ -29,6 +29,15 @@ public function disable_openverse_media_category( array $settings ): array { return $settings; } + /** + * Dsiable the WP block editor font library + */ + public function disable_font_library_ui( array $settings ): array { + $settings['fontLibraryEnabled'] = false; + + return $settings; + } + /** * Disable Block Editor Widget Support */