Automattic\WooCommerce\Internal\Features

FeaturesController::filter_plugins_list()publicWC 1.0

Handler for the all_plugins filter.

Returns the list of plugins incompatible with a given plugin if we are in the plugins page and the query string of the current request looks like '?plugin_status=incompatible_with_feature&feature_id=<feature id>'.

Method of the class: FeaturesController{}

No Hooks.

Return

null. Nothing (null).

Usage

$FeaturesController = new FeaturesController();
$FeaturesController->filter_plugins_list( $plugin_list ): array;
$plugin_list(array) (required)
The original list of plugins.

FeaturesController::filter_plugins_list() code WC 9.3.3

public function filter_plugins_list( $plugin_list ): array {
	if ( ! $this->verify_did_woocommerce_init() ) {
		return $plugin_list;
	}

	// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput
	if ( ! function_exists( 'get_current_screen' ) || get_current_screen() && 'plugins' !== get_current_screen()->id || 'incompatible_with_feature' !== ArrayUtil::get_value_or_default( $_GET, 'plugin_status' ) ) {
		return $plugin_list;
	}

	$feature_id = $_GET['feature_id'] ?? 'all';
	if ( 'all' !== $feature_id && ! $this->feature_exists( $feature_id ) ) {
		return $plugin_list;
	}

	return $this->get_incompatible_plugins( $feature_id, $plugin_list );
}