Skip to content

Commit

Permalink
if we're only outputting incompatible plugins, filter the array
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzsequence committed Aug 27, 2024
1 parent 4ac61b8 commit 705bf8e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion inc/site-health.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ function output_compatibility_content( $tab ) {
*
* @param array $plugins
* @param bool $output
* @param bool $incompatible True if only incompatible plugin issues should be displayed.
*/
function output_compatibility_status_table( $plugins, $output = true ) {
function output_compatibility_status_table( $plugins, $output = true, $incompatible = false ) {
ob_start();
?>
<table class='widefat striped health-check-table' role='presentation'>
Expand All @@ -148,6 +149,14 @@ function output_compatibility_status_table( $plugins, $output = true ) {
</thead>
<tbody>
<?php

// Filter out incompatible plugins. This allows us to re-use the status table for different types of compatibility issues.
if ( $incompatible && ( ! isset( $plugin['plugin_compatibility'] ) || $plugin['plugin_compatibility'] !== 'incompatible' ) ) {
$plugins = array_filter( $plugins, function( $plugins ) {
return $plugins['plugin_compatibility'] === 'incompatible';
} );
}

foreach ( $plugins as $field ) {
/* translators: %s: A plugin's compatibility status. */
$status = sprintf( __( '%s', 'pantheon' ), ucfirst( $field['plugin_status'] ) );
Expand Down

0 comments on commit 705bf8e

Please sign in to comment.