Automattic\WooCommerce\Internal\Features

FeaturesController::filter_plugins_list()privateWC 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

// private - for code of main (parent) class only
$result = $this->filter_plugins_list( $list ): array;
$list(array) (required)
The original list of plugins.

FeaturesController::filter_plugins_list() code WC 8.6.1

private function filter_plugins_list( $list ): array {
	if ( ! $this->verify_did_woocommerce_init() ) {
		return $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 $list;
	}

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

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