` to the admin body classes. * * The compiled stylesheet scopes to this class as well as to the * shell root, because toasts / dialogs / tooltips / context menus * mount on `document.body`, outside `#os-shell`. * * `admin_body_class` is a STRING filter — concatenate, never * array-push. * * @param string $classes Space-separated class list. * @return string */ function openstation_desktop_theme_body_class( $classes ) { if ( ! openstation_desktop_theme_request_is_themable() ) { return $classes; } $slug = openstation_active_desktop_theme_slug(); if ( '' === $slug ) { return $classes; } return trim( $classes . ' os-desktop-theme-' . $slug ); } add_filter( 'admin_body_class', 'openstation_desktop_theme_body_class', 20 ); /** * Inject the desktop-theme bits of the shell config. * * Uses the public `openstation_shell_config` filter rather than * editing the config literal in `includes/render/assets.php`, the * same way the stored-files module contributes `desktopStorage`. * * @param array $config Shell config. * @return array */ function openstation_desktop_theme_inject_shell_config( $config ) { $config['canManageDesktopThemes'] = current_user_can( openstation_desktop_theme_upload_capability() ); $config['desktopThemesUrl'] = esc_url_raw( rest_url( 'desktop-mode/v1/desktop-themes' ) ); return $config; } add_filter( 'openstation_shell_config', 'openstation_desktop_theme_inject_shell_config', 20 );