Automattic\WooCommerce\Internal\Features

FeaturesController::get_plugins_are_incompatible_by_default()publicWC 1.0

Check if plugins that don't declare compatibility nor incompatibility with a given feature are to be considered incompatible with that feature.

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

Возвращает

true|false. True if plugins that don't declare compatibility nor incompatibility with the feature will be considered incompatible with the feature.

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

$FeaturesController = new FeaturesController();
$FeaturesController->get_plugins_are_incompatible_by_default( $feature_id ): bool;
$feature_id(строка) (обязательный)
Feature id to check.

Код FeaturesController::get_plugins_are_incompatible_by_default() WC 9.3.3

public function get_plugins_are_incompatible_by_default( string $feature_id ): bool {
	$feature_definition = $this->get_feature_definitions()[ $feature_id ] ?? null;
	if ( is_null( $feature_definition ) ) {
		throw new \InvalidArgumentException( esc_html( "The WooCommerce feature '$feature_id' doesn't exist" ) );
	}

	$incompatible_by_default = $feature_definition['plugins_are_incompatible_by_default'] ?? false;

	/**
	 * Filter to determine if plugins that don't declare compatibility nor incompatibility with a given feature
	 * are to be considered incompatible with that feature.
	 *
	 * @param bool $incompatible_by_default Default value, true if plugins are to be considered incompatible by default with the feature.
	 * @param string $feature_id The feature to check.
	 *
	 * @since 9.2.0
	 */
	return (bool) apply_filters( 'woocommerce_plugins_are_incompatible_with_feature_by_default', $incompatible_by_default, $feature_id );
}