From 6531550c8ae8ef14e182b4146b8a613b95b01db9 Mon Sep 17 00:00:00 2001 From: "Joen A." Date: Mon, 23 Nov 2026 11:58:08 +0100 Subject: [PATCH 1/2] Plugins: Replace the plugin card dependency notice with a line of text. On the Add Plugins screen, a plugin's dependencies were listed in a `notice notice-alt notice-info inline` block rendered between `.plugin-card-top` and `.plugin-card-bottom`. The block occupied around 100px, and because the cards in a row share a height, one card with dependencies stretched its neighbours. The dependencies are now listed in a single line of text, `Requires:` followed by the dependency names, rendered inside `.plugin-card-top` after the authors line so it inherits the card's text flow and gutters. Each dependency's name is the link to its own details modal, replacing the separate 'More Details' link that duplicated the card's own link. `.plugin-card .notice.plugin-dependencies`, `.plugin-dependency` and `.plugin-dependency-name` are no longer rendered, and their styles are removed. See #66781. Co-Authored-By: Claude Opus 5 --- src/wp-admin/css/list-tables.css | 42 +------------- .../class-wp-plugin-install-list-table.php | 57 ++++++++++--------- ...nInstallListTableGetDependenciesNotice.php | 34 ++++++----- 3 files changed, 54 insertions(+), 79 deletions(-) diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css index f6105ad5a59fb..1947706ff42f9 100644 --- a/src/wp-admin/css/list-tables.css +++ b/src/wp-admin/css/list-tables.css @@ -1600,45 +1600,9 @@ div.action-links, display: none; } -.plugin-card .notice.plugin-dependencies { - margin: auto 20px 20px; - padding: 15px; -} - -.plugin-card .plugin-dependencies-explainer-text { - margin-block: 0; -} - -.plugin-card .plugin-dependency { - align-items: center; - display: flex; - flex-wrap: wrap; - margin-top: 0.5em; - column-gap: 1%; - row-gap: 0.5em; -} - -.plugin-card .plugin-dependency:nth-child(2), -.plugin-card .plugin-dependency:last-child { - margin-top: 1em; -} - -.plugin-card .plugin-dependency-name { - flex-basis: 74%; -} - -.plugin-card .plugin-dependency .more-details-link { - margin-left: auto; -} - -.rtl .plugin-card .plugin-dependency .more-details-link { - margin-right: auto; -} - -@media (max-width: 939px) { - .plugin-card .plugin-dependency-name { - flex-basis: 69%; - } +/* Sits in the card's text flow, directly below the authors line. */ +.plugin-card .plugin-dependencies-inline { + margin-bottom: 0; } .plugins #the-list .required-by, diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php index 3f6d2a104d099..2b78f36d87ba8 100644 --- a/src/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -760,14 +760,14 @@ public function display_rows() {

+ get_dependencies_notice( $plugin ); + if ( ! empty( $dependencies_notice ) ) { + echo $dependencies_notice; + } + ?>
- get_dependencies_notice( $plugin ); - if ( ! empty( $dependencies_notice ) ) { - echo $dependencies_notice; - } - ?>
%s
'; - $has_name_markup = '
%s %s
'; - - $dependencies_list = ''; + $dependencies = array(); foreach ( $plugin_data['requires_plugins'] as $dependency ) { $dependency_data = WP_Plugin_Dependencies::get_dependency_data( $dependency ); @@ -856,41 +854,42 @@ protected function get_dependencies_notice( $plugin_data ) { ! empty( $dependency_data['slug'] ) && ! empty( $dependency_data['version'] ) ) { - $more_details_link = $this->get_more_details_link( $dependency_data['name'], $dependency_data['slug'] ); - $dependencies_list .= sprintf( $has_name_markup, esc_html( $dependency_data['name'] ), $more_details_link ); + $dependencies[] = $this->get_more_details_link( $dependency_data['name'], $dependency_data['slug'], $dependency_data['name'] ); continue; } $result = plugins_api( 'plugin_information', array( 'slug' => $dependency ) ); if ( ! empty( $result->name ) ) { - $more_details_link = $this->get_more_details_link( $result->name, $result->slug ); - $dependencies_list .= sprintf( $has_name_markup, esc_html( $result->name ), $more_details_link ); + $dependencies[] = $this->get_more_details_link( $result->name, $result->slug, $result->name ); continue; } - $dependencies_list .= sprintf( $no_name_markup, esc_html( $dependency ) ); + $dependencies[] = esc_html( $dependency ); } - $dependencies_notice = sprintf( - '

%s

%s
', - '' . __( 'Additional plugins are required' ) . '', - $dependencies_list + return sprintf( + '

%s

', + sprintf( + /* translators: %s: List of dependency names. */ + _n( 'Requires: %s', 'Requires: %s', count( $dependencies ) ), + implode( wp_get_list_item_separator(), $dependencies ) + ) ); - - return $dependencies_notice; } /** * Creates a 'More details' link for the plugin. * * @since 6.5.0 + * @since 7.2.0 Added the `$link_text` parameter. * - * @param string $name The plugin's name. - * @param string $slug The plugin's slug. + * @param string $name The plugin's name. + * @param string $slug The plugin's slug. + * @param string $link_text Optional. The link's text. Default 'More Details'. * @return string The 'More details' link for the plugin. */ - protected function get_more_details_link( $name, $slug ) { + protected function get_more_details_link( $name, $slug, $link_text = '' ) { $url = add_query_arg( array( 'tab' => 'plugin-information', @@ -902,13 +901,17 @@ protected function get_more_details_link( $name, $slug ) { network_admin_url( 'plugin-install.php' ) ); + if ( '' === $link_text ) { + $link_text = __( 'More Details' ); + } + $more_details_link = sprintf( '%4$s', esc_url( $url ), /* translators: %s: Plugin name. */ sprintf( __( 'More information about %s' ), esc_html( $name ) ), esc_attr( $name ), - __( 'More Details' ) + esc_html( $link_text ) ); return $more_details_link; diff --git a/tests/phpunit/tests/admin/wpPluginInstallListTableGetDependenciesNotice.php b/tests/phpunit/tests/admin/wpPluginInstallListTableGetDependenciesNotice.php index 776e6f6e6cc25..55abf803c9751 100644 --- a/tests/phpunit/tests/admin/wpPluginInstallListTableGetDependenciesNotice.php +++ b/tests/phpunit/tests/admin/wpPluginInstallListTableGetDependenciesNotice.php @@ -12,11 +12,18 @@ class Tests_Admin_wpPluginInstallListTableGetDependenciesNotice extends WP_UnitTestCase { /** - * The notice before the list of dependencies. + * The start of the line listing the dependencies. * * @var string */ - const NOTICE_START = '

Additional plugins are required

'; + const NOTICE_START = '

Requires: '; + + /** + * The end of the line listing the dependencies. + * + * @var string + */ + const NOTICE_END = '

'; /** * The list table. @@ -88,7 +95,7 @@ public function tear_down() { } /** - * Tests that no notice is returned for a plugin without dependencies. + * Tests that nothing is returned for a plugin without dependencies. * * @ticket 65819 * @@ -129,7 +136,7 @@ public function test_should_name_dependency_from_dependency_data() { ); $this->assertSame( - self::NOTICE_START . $this->get_named_dependency( 'Dep <b>&</b> "One"', 'dep-one' ) . '
', + self::NOTICE_START . $this->get_named_dependency( 'Dep <b>&</b> "One"', 'dep-one' ) . self::NOTICE_END, $this->get_dependencies_notice( array( 'requires_plugins' => array( 'dep-one' ) ) ), 'The dependency should be named from the stored data.' ); @@ -153,7 +160,7 @@ public function test_should_use_slug_from_dependency_data() { ); $this->assertSame( - self::NOTICE_START . $this->get_named_dependency( 'Dep One', 'dep-one-renamed' ) . '
', + self::NOTICE_START . $this->get_named_dependency( 'Dep One', 'dep-one-renamed' ) . self::NOTICE_END, $this->get_dependencies_notice( array( 'requires_plugins' => array( 'dep-one' ) ) ) ); } @@ -178,7 +185,7 @@ public function test_should_fall_back_to_plugins_api_for_incomplete_dependency_d ); $this->assertSame( - self::NOTICE_START . $this->get_named_dependency( 'Dep One From API', 'dep-one' ) . '', + self::NOTICE_START . $this->get_named_dependency( 'Dep One From API', 'dep-one' ) . self::NOTICE_END, $this->get_dependencies_notice( array( 'requires_plugins' => array( 'dep-one' ) ) ), 'The dependency should be named from the plugins API.' ); @@ -218,7 +225,7 @@ public function test_should_use_slug_from_plugins_api() { ); $this->assertSame( - self::NOTICE_START . $this->get_named_dependency( 'Dep <i>One</i>', 'renamed-dep' ) . '', + self::NOTICE_START . $this->get_named_dependency( 'Dep <i>One</i>', 'renamed-dep' ) . self::NOTICE_END, $this->get_dependencies_notice( array( 'requires_plugins' => array( 'dep-one' ) ) ) ); } @@ -241,7 +248,7 @@ public function test_should_list_dependency_by_slug_without_name( $response ) { ); $this->assertSame( - self::NOTICE_START . '
dep<one>
', + self::NOTICE_START . 'dep<one>' . self::NOTICE_END, $this->get_dependencies_notice( array( 'requires_plugins' => array( 'dep' ) ) ) ); } @@ -283,9 +290,11 @@ public function test_should_list_all_dependencies_in_order() { $this->assertSame( self::NOTICE_START . $this->get_named_dependency( 'Dep One', 'dep-one' ) + . wp_get_list_item_separator() . $this->get_named_dependency( 'Dep Two', 'dep-two' ) - . '
dep-three
' - . '', + . wp_get_list_item_separator() + . 'dep-three' + . self::NOTICE_END, $this->get_dependencies_notice( array( 'requires_plugins' => array( 'dep-one', 'dep-two', 'dep-three' ) ) ), 'Each dependency should be listed in order.' ); @@ -303,9 +312,8 @@ private function get_named_dependency( $escaped_name, $slug ) { $url = 'http://' . WP_TESTS_DOMAIN . '/wp-admin/' . ( is_multisite() ? 'network/' : '' ) . 'plugin-install.php?tab=plugin-information&plugin=' . $slug . '&TB_iframe=true&width=600&height=550'; - return '
' . $escaped_name . ' ' - . 'More Details' - . '
'; + return '' . $escaped_name . ''; } /** From cb0a93f2fef9845477bb8ffbefbfe6329e1feda7 Mon Sep 17 00:00:00 2001 From: "Joen A." Date: Mon, 23 Nov 2026 13:02:40 +0100 Subject: [PATCH 2/2] Plugins: Use 7.3.0 for the new @since annotations. Trunk is in the 7.2 release candidate phase, so these changes land in 7.3. Co-Authored-By: Claude Opus 5 --- src/wp-admin/includes/class-wp-plugin-install-list-table.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php index 2b78f36d87ba8..e2dd9e846e554 100644 --- a/src/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -832,7 +832,7 @@ public function display_rows() { * Returns a line of text listing the dependencies required by the plugin. * * @since 6.5.0 - * @since 7.2.0 The dependencies are listed in a line of text instead of a notice. + * @since 7.3.0 The dependencies are listed in a line of text instead of a notice. * * @param array $plugin_data An array of plugin data. See {@see plugins_api()} * for the list of possible values. @@ -882,7 +882,7 @@ protected function get_dependencies_notice( $plugin_data ) { * Creates a 'More details' link for the plugin. * * @since 6.5.0 - * @since 7.2.0 Added the `$link_text` parameter. + * @since 7.3.0 Added the `$link_text` parameter. * * @param string $name The plugin's name. * @param string $slug The plugin's slug.