Automattic\WooCommerce\Internal\Admin
LegacyReportsMenu::has_extension_reports
Whether an extension adds to or changes the legacy reports.
Analytics also applies woocommerce_admin_reports, so hooking it isn't enough on its own: the filtered legacy reports must contain a report core doesn't define, or a core report with a different callback.
Метод класса: LegacyReportsMenu{}
Хуков нет.
Возвращает
bool.
Использование
// private - только в коде основоного (родительского) класса $result = $this->has_extension_reports(): bool;
Код LegacyReportsMenu::has_extension_reports() LegacyReportsMenu::has extension reports WC 11.3.0
private function has_extension_reports(): bool {
if ( has_action( 'wc_reports_tabs' ) || has_filter( 'wc_admin_reports_path' ) ) {
return true;
}
if ( ! has_filter( 'woocommerce_admin_reports' ) && ! has_filter( 'woocommerce_reports_charts' ) ) {
return false;
}
if ( ! class_exists( 'WC_Admin_Reports', false ) ) {
return false;
}
foreach ( \WC_Admin_Reports::get_reports() as $group_key => $group ) {
if ( ! is_array( $group ) || ! is_array( $group['reports'] ?? null ) ) {
continue;
}
foreach ( $group['reports'] as $report_key => $report ) {
if ( ! in_array( $report_key, self::CORE_REPORTS[ $group_key ] ?? array(), true ) ) {
return true;
}
if ( ! is_array( $report ) || self::CORE_CALLBACK !== ( $report['callback'] ?? null ) ) {
return true;
}
}
}
return false;
}