Automattic\WooCommerce\Admin\Features\OnboardingTasks

TaskLists::menu_task_count()public staticWC 1.0

Add badge to homescreen menu item for remaining tasks

{} It's a method of the class: TaskLists{}

No Hooks.

Return

null. Nothing.

Usage

$result = TaskLists::menu_task_count();

Code of TaskLists::menu_task_count() WC 6.8.2

public static function menu_task_count() {
	global $submenu;

	$tasks_count = self::setup_tasks_remaining();

	if ( ! $tasks_count || ! isset( $submenu['woocommerce'] ) ) {
		return;
	}

	foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
		if ( 0 === strpos( $menu_item[0], _x( 'Home', 'Admin menu name', 'woocommerce' ) ) ) {
			$submenu['woocommerce'][ $key ][0] .= ' <span class="awaiting-mod update-plugins remaining-tasks-badge count-' . esc_attr( $tasks_count ) . '">' . number_format_i18n( $tasks_count ) . '</span>'; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
			break;
		}
	}

}