Automattic\WooCommerce\Internal\Features

FeaturesController::get_compatible_plugins_for_feature()publicWC 1.0

Get the names of the plugins that have been declared compatible or incompatible with a given feature.

Метод класса: FeaturesController{}

Хуков нет.

Возвращает

Массив. An array having a 'compatible' and an 'incompatible' key, each holding an array of plugin names.

Использование

$FeaturesController = new FeaturesController();
$FeaturesController->get_compatible_plugins_for_feature( $feature_id, $active_only ) : array;
$feature_id(строка) (обязательный)
Feature id.
$active_only(true|false)
True to return only active plugins.
По умолчанию: false

Код FeaturesController::get_compatible_plugins_for_feature() WC 8.7.0

public function get_compatible_plugins_for_feature( string $feature_id, bool $active_only = false ) : array {
	$this->verify_did_woocommerce_init( __FUNCTION__ );

	$woo_aware_plugins = $this->plugin_util->get_woocommerce_aware_plugins( $active_only );
	if ( ! $this->feature_exists( $feature_id ) ) {
		return array(
			'compatible'   => array(),
			'incompatible' => array(),
			'uncertain'    => $woo_aware_plugins,
		);
	}

	$info              = $this->compatibility_info_by_feature[ $feature_id ];
	$info['uncertain'] = array_values( array_diff( $woo_aware_plugins, $info['compatible'], $info['incompatible'] ) );

	return $info;
}