Automattic\WooCommerce\Internal\Admin

LegacyReportsMenu::should_show │ private │ WC 1.0

Whether the legacy Reports menu item should be shown.

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

Хуки из метода

Возвращает

bool.

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

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

Код LegacyReportsMenu::should_show() WC 11.3.0

private function should_show(): bool {
	$show = ! $this->is_new_store()
		|| ! FeaturesUtil::feature_is_enabled( 'analytics' )
		|| $this->has_extension_reports();

	/**
	 * Filters whether to show the legacy WooCommerce > Reports menu item.
	 *
	 * The page stays reachable at admin.php?page=wc-reports either way. By default the item is hidden on
	 * stores first installed on WooCommerce 11.3.0 or later, unless Analytics is disabled or an extension
	 * adds legacy reports. Runs at the end of admin_menu, so add callbacks before then.
	 *
	 * @since 11.3.0
	 *
	 * @param bool $show Whether to show the menu item.
	 */
	$filtered = apply_filters( 'woocommerce_show_legacy_reports_menu', $show );

	$filtered = is_scalar( $filtered ) ? filter_var( $filtered, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ) : null;

	return $filtered ?? $show;
}