You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin will add a new “Check this plugin” link to the WP Admin > Plugins list table. The link will go to the new Tools page introduced by the plugin. The link will have a plugin file (e.g., akismet/akismet.php) as a request parameter so that the Plugin Check can recognize from the request that it needs to start checks on it.
All the processes after the link have been recognized will be the same as when the user clicks on the “Check it!” link as outlined in the AJAX functionality.
Acceptance Criteria
filter_plugin_action_links() method should exist in the Admin_Page class (see this class details on Create Tools page #32 )
Add plugin_action_links filter in the add_hooks() and append the filter_plugin_action_links() method in that hook. like below:
filter_plugin_action_links() method should take two arguments, $actions and $plugin_file.
Based on the $plugin_file's argument, it will return the anchor (<a>) link tag with query the string page=plugin-check&plugin=$plugin_file to point to the tools page.
The link text will be Check this plugin, so the end code of the filter_plugin_action_links() method will look something like below:
public function filter_plugin_action_links( $actions, $plugin_file ) {
$actions[] = '<a href="' . esc_url( admin_url() . 'tools.php?page=plugin-check&plugin=' . $plugin_file ) . '">'.esc_html__( 'Check this plugin' , 'plugin-check').'</a>';
return $actions;
}
Once the user lands on the Plugin Check page, the plugin's dropdown should be populated based on the plugin param of the query string.
Test Coverage
Automated Tests:
Write a test case to check whether the plugin_action_links filter is registering.
Write a test case for the filter_plugin_action_links() method that it is generating the proper URL or not.
Manual Tests:
Login to the admin area, go to the plugin list and check if the Check this plugin link is available.
Click on any plugin's Check this plugin link and check the user redirecting to the Plugin Check page and populating the plugin list dropdown with the proper plugin name.
Description
The plugin will add a new “Check this plugin” link to the WP Admin > Plugins list table. The link will go to the new Tools page introduced by the plugin. The link will have a plugin file (e.g., akismet/akismet.php) as a request parameter so that the Plugin Check can recognize from the request that it needs to start checks on it.
All the processes after the link have been recognized will be the same as when the user clicks on the “Check it!” link as outlined in the AJAX functionality.
Acceptance Criteria
filter_plugin_action_links()method should exist in theAdmin_Pageclass (see this class details on Create Tools page #32 )Add
plugin_action_linksfilter in theadd_hooks()and append thefilter_plugin_action_links()method in that hook. like below:add_filter( 'plugin_action_links', array( $this, 'filter_plugin_action_links' ), 10, 2 );filter_plugin_action_links()method should take two arguments,$actionsand$plugin_file.Based on the
$plugin_file's argument, it will return the anchor (<a>) link tag with query the stringpage=plugin-check&plugin=$plugin_fileto point to the tools page.The link text will be
Check this plugin, so the end code of thefilter_plugin_action_links()method will look something like below:Once the user lands on the
Plugin Checkpage, the plugin's dropdown should be populated based on thepluginparam of the query string.Test Coverage
Automated Tests:
plugin_action_linksfilter is registering.filter_plugin_action_links()method that it is generating the proper URL or not.Manual Tests:
Check this pluginlink is available.Check this pluginlink and check the user redirecting to thePlugin Checkpage and populating the plugin list dropdown with the proper plugin name.