| @@ -32,8 +32,9 @@ | ||
| 32 | 32 | if ( ! defined( 'ABSPATH' ) ) { |
| 33 | 33 | defined( 'OPENSTATION_STANDALONE' ) || exit; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | +require_once __DIR__ . '/parts/view-preference.php'; | |
| 36 | 37 | require_once __DIR__ . '/parts/permissions.php'; |
| 37 | 38 | require_once __DIR__ . '/parts/rest-fields.php'; |
| 38 | 39 | require_once __DIR__ . '/parts/updates.php'; |
| 39 | 40 | require_once __DIR__ . '/parts/icons.php'; |
| @@ -291,23 +292,56 @@ | ||
| 291 | 292 | // The global "Automatic Updates" column gate — computed |
| 292 | 293 | // on the admin page load (it needs an admin include), |
| 293 | 294 | // which is why it rides the config rather than `data()`. |
| 294 | 295 | 'autoUpdatesEnabled' => openstation_plugins_window_auto_updates_enabled(), |
| 296 | + // The deactivation feedback dialog's lazy bundle and | |
| 297 | + // route; `null` when the feature is filtered off. | |
| 298 | + 'deactivationFeedback' => openstation_deactivation_feedback_app_config(), | |
| 299 | + // Core's Plugin File Editor stays Core's screen: a tab | |
| 300 | + // opens it as its own window, offered only where Core | |
| 301 | + // lists it under Plugins (`''` everywhere else). | |
| 302 | + 'editorUrl' => openstation_plugins_window_editor_url(), | |
| 295 | 303 | ); |
| 296 | 304 | } |
| 297 | 305 | ) |
| 306 | + // The Plugins menu, while this window answers for it. The file | |
| 307 | + // editor is deliberately not a row: it is a tab the window opens | |
| 308 | + // on a file you picked, not a page you can ask for cold. | |
| 309 | + ->menu( | |
| 310 | + 'plugins.php', | |
| 311 | + static function () { | |
| 312 | + $caps = openstation_plugins_window_caps(); | |
| 313 | + $tabs = array( | |
| 314 | + 'installed' => array( | |
| 315 | + 'label' => __( 'Installed', 'desktop-mode' ), | |
| 316 | + 'page' => 'plugins.php', | |
| 317 | + ), | |
| 318 | + ); | |
| 319 | + if ( ! empty( $caps['install'] ) ) { | |
| 320 | + $tabs['browse'] = array( | |
| 321 | + 'label' => __( 'Add Plugin', 'desktop-mode' ), | |
| 322 | + 'page' => 'plugin-install.php', | |
| 323 | + ); | |
| 324 | + $tabs['featured'] = __( 'OpenStation plugins', 'desktop-mode' ); | |
| 325 | + } | |
| 326 | + return $tabs; | |
| 327 | + }, | |
| 328 | + 'openstation_plugins_window_user_can_use' | |
| 329 | + ) | |
| 298 | 330 | ->state( |
| 299 | 331 | array( |
| 300 | - 'tab' => 'installed', | |
| 332 | + 'tab' => 'installed', | |
| 333 | + 'installedView' => 'cards', | |
| 301 | 334 | // Installed tab: status segment (`''` = all) and search. |
| 302 | - 'status' => '', | |
| 303 | - 'search' => '', | |
| 335 | + 'status' => '', | |
| 336 | + 'search' => '', | |
| 304 | 337 | // Browse tab: wp.org browse segment and search query. |
| 305 | - 'browse' => 'featured', | |
| 306 | - 'query' => '', | |
| 338 | + 'browse' => 'featured', | |
| 339 | + 'query' => '', | |
| 307 | 340 | ) |
| 308 | 341 | ) |
| 309 | - ->mount( __NAMESPACE__ . '\apply_tab' ) | |
| 342 | + ->mount( __NAMESPACE__ . '\mount_plugins' ) | |
| 343 | + ->action( 'save_view', __NAMESPACE__ . '\save_installed_view' ) | |
| 310 | 344 | ->action( 'reopen', __NAMESPACE__ . '\apply_tab' ) |
| 311 | 345 | // The Refresh button: a fresh wp.org check (bypassing Core's 12h |
| 312 | 346 | // throttle) before `data()` re-reads the list, and the dock badge |
| 313 | 347 | // repainted from the same snapshot. |