Automattic\WooCommerce\Internal\Features

FeaturesController::maybe_display_feature_incompatibility_warning()privateWC 1.0

Shows a warning when there are any incompatibility between active plugins and enabled features. The warning is shown in on any admin screen except the plugins screen itself, since there's already a "You are viewing

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

Хуков нет.

Возвращает

null. Ничего.

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

// private - только в коде основоного (родительского) класса
$result = $this->maybe_display_feature_incompatibility_warning(): void;

Код FeaturesController::maybe_display_feature_incompatibility_warning() WC 7.1.1

<?php
private function maybe_display_feature_incompatibility_warning(): void {
	$incompatible_plugins = false;

	foreach ( $this->plugin_util->get_woocommerce_aware_plugins( true ) as $plugin ) {
		$compatibility     = $this->get_compatible_features_for_plugin( $plugin, true );
		$incompatible_with = array_diff(
			array_merge( $compatibility['incompatible'], $compatibility['uncertain'] ),
			$this->legacy_feature_ids
		);

		if ( $incompatible_with ) {
			$incompatible_plugins = true;
			break;
		}
	}

	if ( ! $incompatible_plugins ) {
		return;
	}

	$message = str_replace(
		'<a>',
		'<a href="' . esc_url( add_query_arg( array( 'plugin_status' => 'incompatible_with_feature' ), admin_url( 'plugins.php' ) ) ) . '">',
		__( 'WooCommerce has detected that some of your active plugins are incompatible with currently enabled WooCommerce features. Please <a>review the details</a>.', 'woocommerce' )
	);

	// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
	?>
	<div class="notice notice-error">
	<p><?php echo $message; ?></p>
	</div>
	<?php
	// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
}