From e80f14f3ed898669f5001efff9cbf046290f1e98 Mon Sep 17 00:00:00 2001 From: goncaloasimoes <32324608+goncaloasimoes@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:37:14 +0000 Subject: [PATCH] Add support for pattern editor --- CHANGELOG.md | 4 ++++ lib/Admin/Admin.php | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c023507..61a6698 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Added support for WP Block site pattern editor. + ### Fixed - Fatal error when deleting a menu in the backoffice. diff --git a/lib/Admin/Admin.php b/lib/Admin/Admin.php index df5feac..19ad13c 100644 --- a/lib/Admin/Admin.php +++ b/lib/Admin/Admin.php @@ -218,6 +218,7 @@ public static function is_block_editor( WP_Screen $screen = null ) : bool { * * Stop enqueuing scripts if the current screen is for an untranslatable post type. * + * @since Unreleased Add WP_Block support and fix issue with bad return. * @since 0.4.0 * * @return bool @@ -229,9 +230,12 @@ private function should_enqueue_scripts() : bool { if ( ! $screen instanceof WP_Screen - || $screen->base !== 'post' + || ( + $screen->base !== 'post' + && ! ( LangInterface::is_post_type_translatable( 'wp_block' ) && $screen->base === 'site-editor' ) + ) ) { - return true; + return false; } $post_type = get_post_type();