Automattic\WooCommerce\Admin
PluginsInstaller::cache_results
Display the results of installation and activation on the page.
Method of the class: PluginsInstaller{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = PluginsInstaller::cache_results( $plugins, $install_result, $activate_result );
- $plugins(string) (required)
- Comma separated list of plugins.
- $install_result(array) (required)
- Result of installation.
- $activate_result(array) (required)
- Result of activation.
PluginsInstaller::cache_results() PluginsInstaller::cache results code WC 10.7.0
public static function cache_results( $plugins, $install_result, $activate_result ) {
if ( ! $install_result && ! $activate_result ) {
return;
}
if ( is_wp_error( $install_result ) || is_wp_error( $activate_result ) ) {
$message = $activate_result ? $activate_result->get_error_message() : $install_result->get_error_message();
} else {
$message = $activate_result ? $activate_result['message'] : $install_result['message'];
}
TransientNotices::add(
array(
'user_id' => get_current_user_id(),
'id' => 'plugin-installer-' . str_replace( ',', '-', $plugins ),
'status' => 'success',
'content' => $message,
)
);
}