Automattic\WooCommerce\Internal\Admin\Onboarding

OnboardingHelper::add_help_tab()publicWC 1.0

Update the help tab setup link to reset the onboarding profiler.

{} Это метод класса: OnboardingHelper{}

Хуков нет.

Возвращает

null. Ничего.

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

$OnboardingHelper = new OnboardingHelper();
$OnboardingHelper->add_help_tab();

Код OnboardingHelper::add_help_tab() WC 6.6.1

public function add_help_tab() {
	if ( ! function_exists( 'wc_get_screen_ids' ) ) {
		return;
	}

	$screen = get_current_screen();

	if ( ! $screen || ! in_array( $screen->id, wc_get_screen_ids(), true ) ) {
		return;
	}

	// Remove the old help tab if it exists.
	$help_tabs = $screen->get_help_tabs();
	foreach ( $help_tabs as $help_tab ) {
		if ( 'woocommerce_onboard_tab' !== $help_tab['id'] ) {
			continue;
		}

		$screen->remove_help_tab( 'woocommerce_onboard_tab' );
	}

	// Add the new help tab.
	$help_tab = array(
		'title' => __( 'Setup wizard', 'woocommerce' ),
		'id'    => 'woocommerce_onboard_tab',
	);

	$setup_list    = TaskLists::get_list( 'setup' );
	$extended_list = TaskLists::get_list( 'extended' );

	if ( $setup_list ) {
		$help_tab['content'] = '<h2>' . __( 'WooCommerce Onboarding', 'woocommerce' ) . '</h2>';

		$help_tab['content'] .= '<h3>' . __( 'Profile Setup Wizard', 'woocommerce' ) . '</h3>';
		$help_tab['content'] .= '<p>' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '</p>' .
			'<p><a href="' . wc_admin_url( '&path=/setup-wizard' ) . '" class="button button-primary">' . __( 'Setup wizard', 'woocommerce' ) . '</a></p>';

		$help_tab['content'] .= '<h3>' . __( 'Task List', 'woocommerce' ) . '</h3>';
		$help_tab['content'] .= '<p>' . __( 'If you need to enable or disable the task lists, please click on the button below.', 'woocommerce' ) . '</p>' .
		( $setup_list->is_hidden()
			? '<p><a href="' . wc_admin_url( '&reset_task_list=1' ) . '" class="button button-primary">' . __( 'Enable', 'woocommerce' ) . '</a></p>'
			: '<p><a href="' . wc_admin_url( '&reset_task_list=0' ) . '" class="button button-primary">' . __( 'Disable', 'woocommerce' ) . '</a></p>'
		);
	}

	if ( $extended_list ) {
		$help_tab['content'] .= '<h3>' . __( 'Extended task List', 'woocommerce' ) . '</h3>';
		$help_tab['content'] .= '<p>' . __( 'If you need to enable or disable the extended task lists, please click on the button below.', 'woocommerce' ) . '</p>' .
		( $extended_list->is_hidden()
			? '<p><a href="' . wc_admin_url( '&reset_extended_task_list=1' ) . '" class="button button-primary">' . __( 'Enable', 'woocommerce' ) . '</a></p>'
			: '<p><a href="' . wc_admin_url( '&reset_extended_task_list=0' ) . '" class="button button-primary">' . __( 'Disable', 'woocommerce' ) . '</a></p>'
		);
	}

	$screen->add_help_tab( $help_tab );
}