Skip to content

Commit

Permalink
Inject TGM_Plugin_Activation into TGMPA_List_Table
Browse files Browse the repository at this point in the history
This allows each list to use its corresponding TGMPA instance, instead of all lists using the same global instance.

TGMPA#804
  • Loading branch information
XedinUnknown committed Apr 27, 2021
1 parent 71ac1e2 commit 989ab79
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions class-tgm-plugin-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ protected function add_admin_menu( array $args ) {
*/
public function install_plugins_page() {
// Store new instance of plugin table in object.
$plugin_table = new TGMPA_List_Table();
$plugin_table = new TGMPA_List_Table($this);

// Return early if processing a plugin installation action.
if ( ( ( 'tgmpa-bulk-install' === $plugin_table->current_action() || 'tgmpa-bulk-update' === $plugin_table->current_action() ) && $plugin_table->process_bulk_actions() ) || $this->do_plugin_install() ) {
Expand Down Expand Up @@ -2271,10 +2271,12 @@ class TGMPA_List_Table extends WP_List_Table {
/**
* References parent constructor and sets defaults for class.
*
* @param TGM_Plugin_Activation $tgmpa The TGMPA instance to be used by this list.
*
* @since 2.2.0
*/
public function __construct() {
$this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
public function __construct($tgmpa) {
$this->tgmpa = $tgmpa;

parent::__construct(
array(
Expand Down

0 comments on commit 989ab79

Please sign in to comment.