@@ -67,14 +67,6 @@ private static function menu_icon() {
6767 */
6868 private static $ notice_buffer_level = 0 ;
6969
70- /**
71- * The current user's admin theme (system|light|dark), for the pre-paint
72- * theme boot. Set in enqueue_assets, consumed by print_theme_boot.
73- *
74- * @var string
75- */
76- private static $ theme = 'system ' ;
77-
7870 /**
7971 * On Saddle's screen only: capture other plugins' admin notices instead of
8072 * letting them pile above the app.
@@ -129,24 +121,6 @@ public static function end_notice_capture() {
129121 echo '<div id="saddle-foreign-notices" hidden> ' . $ html . '</div> ' ; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
130122 }
131123
132- /**
133- * Print the pre-paint theme attribute on <body>.
134- *
135- * Runs at the top of the admin content (in_admin_header), before the app
136- * bundle (footer) and before #saddle-root paints, so the design-system
137- * tokens resolve to the right theme with no flash.
138- */
139- public static function print_theme_boot () {
140- $ screen = function_exists ( 'get_current_screen ' ) ? get_current_screen () : null ;
141- if ( ! $ screen || $ screen ->id !== self ::$ hook_suffix ) {
142- return ;
143- }
144- printf (
145- '<script>document.body.dataset.ppTheme=%s;</script> ' ,
146- wp_json_encode ( self ::$ theme )
147- );
148- }
149-
150124 /**
151125 * Render the mount point for the React app.
152126 */
@@ -233,24 +207,16 @@ function () {
233207 wp_set_script_translations ( 'saddle-admin ' , 'saddle ' );
234208
235209 $ current_user = wp_get_current_user ();
236- $ theme = (string ) get_user_meta ( get_current_user_id (), 'saddle_admin_theme ' , true );
237- $ theme = in_array ( $ theme , array ( 'light ' , 'dark ' ), true ) ? $ theme : 'system ' ;
238- self ::$ theme = $ theme ;
239210
240- // The design system reads its --pp-* tokens from a .pp-scope ancestor,
241- // so the page body carries it (portaled overlays inherit the tokens too).
211+ // The design system (light-only) reads its --pp-* tokens from a .pp-scope
212+ // ancestor, so the page body carries it (portaled overlays inherit too).
242213 add_filter (
243214 'admin_body_class ' ,
244215 static function ( $ classes ) {
245216 return $ classes . ' pp-scope ' ;
246217 }
247218 );
248219
249- // Set data-pp-theme on <body> before the app paints, so an explicit
250- // light/dark choice (or a system user's OS preference) never flashes the
251- // other theme. The useTheme hook keeps it in sync after mount.
252- add_action ( 'in_admin_header ' , array ( __CLASS__ , 'print_theme_boot ' ) );
253-
254220 wp_add_inline_script (
255221 'saddle-admin ' ,
256222 'window.saddleData = ' . wp_json_encode (
@@ -268,7 +234,6 @@ static function ( $classes ) {
268234 // Environment facts so the UI can warn before a connect fails.
269235 'appPasswords ' => function_exists ( 'wp_is_application_passwords_available ' ) ? (bool ) wp_is_application_passwords_available () : true ,
270236 'ssl ' => is_ssl (),
271- 'theme ' => $ theme ,
272237 // Where WordPress itself lists these credentials — linked
273238 // from the Connect tab for transparency.
274239 'profileUrl ' => esc_url_raw ( admin_url ( 'profile.php#application-passwords-section ' ) ),
0 commit comments