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..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 @@ -760,14 +760,14 @@ public function display_rows() {
%s
%s%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.3.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' ) . '