Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/full-site-editing/edit-site-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ function gutenberg_is_edit_site_page( $page ) {
return 'appearance_page_gutenberg-edit-site' === $page;
}

// Default to is-fullscreen-mode to avoid rendering wp-admin navigation menu while loading and
// having jumps in the UI.
add_filter(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be executed for all pages, not just the site editor (because the php file is always loaded), should we instead move this into gutenberg_edit_site_init ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, that makes sense. I moved it into that function here c434238

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to also remove the filter as part of the ! gutenberg_is_edit_site_page( $hook ) conditional return?

Copy link
Contributor Author

@Addison-Stavlo Addison-Stavlo Nov 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also curious, does the function need to be static here? I didn't think so, but then I noticed your example in wordpress-develop was also static but didn't seem to be part of a class?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they started using "static" for closures like that recently something about PHP 8 support, but I didn't fully follow the explanations tbh :) So I might think it's better if it's static here as well.

It doesn't seem like we need to remove the filter though as it's only applied if we're on this page so, so it looks good to me.

'admin_body_class',
static function( $classes ) {
return "$classes is-fullscreen-mode";
}
);

/**
* Load editor styles (this is copied from edit-form-blocks.php).
* Ideally the code is extracted into a reusable function.
Expand Down