Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add install note after each PerfLab feature plugin in the plugin list table #1265

Merged
merged 5 commits into from
Jun 3, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions plugins/performance-lab/includes/admin/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,32 @@ function perflab_get_plugin_settings_url( string $plugin_slug ): ?string {

return null;
}

/**
* Prints the Performance Lab install notice after each feature plugin's row meta.
*
* @since n.e.x.t
*
* @param string $plugin_file Plugin file.
*/
function perflab_print_row_meta_install_notice( string $plugin_file ): void {
if ( ! in_array( strtok( $plugin_file, '/' ), perflab_get_standalone_plugins(), true ) ) {
return;
}

$message = sprintf(
/* translators: %s: link to Performance Lab settings screen */
__( 'This plugin is installed by %s.', 'performance-lab' ),
sprintf(
'<a href="%s">%s</a>',
esc_url( add_query_arg( 'page', PERFLAB_SCREEN, admin_url( 'options-general.php' ) ) ),
__( 'Performance Lab', 'performance-lab' )
)
westonruter marked this conversation as resolved.
Show resolved Hide resolved
);

printf(
'<div class="requires"><p>%1$s</p></div>',
mukeshpanchal27 marked this conversation as resolved.
Show resolved Hide resolved
wp_kses( $message, array( 'a' => array( 'href' => array() ) ) )
);
}
add_action( 'after_plugin_row_meta', 'perflab_print_row_meta_install_notice' );
Loading