Automattic\WooCommerce\Admin\Features\OnboardingTasks

TaskLists::init_default_lists()public staticWC 1.0

Initialize default lists.

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

Возвращает

null. Ничего (null).

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

$result = TaskLists::init_default_lists();

Код TaskLists::init_default_lists() WC 8.5.2

public static function init_default_lists() {
	$tasks = array(
		'CustomizeStore',
		'StoreDetails',
		'Products',
		'Appearance',
		'WooCommercePayments',
		'Payments',
		'Tax',
		'Shipping',
		'Marketing',
	);

	if ( Features::is_enabled( 'core-profiler' ) ) {
		$key = array_search( 'StoreDetails', $tasks, true );
		if ( false !== $key ) {
			unset( $tasks[ $key ] );
		}
	}

	// Remove the old Personalize your store task if the new CustomizeStore is enabled.
	$task_to_remove                 = Features::is_enabled( 'customize-store' ) ? 'Appearance' : 'CustomizeStore';
	$store_customisation_task_index = array_search( $task_to_remove, $tasks, true );

	if ( false !== $store_customisation_task_index ) {
		unset( $tasks[ $store_customisation_task_index ] );
	}

	self::add_list(
		array(
			'id'                      => 'setup',
			'title'                   => __( 'Get ready to start selling', 'woocommerce' ),
			'tasks'                   => $tasks,
			'display_progress_header' => true,
			'event_prefix'            => 'tasklist_',
			'options'                 => array(
				'use_completed_title' => true,
			),
			'visible'                 => true,
		)
	);

	self::add_list(
		array(
			'id'      => 'extended',
			'title'   => __( 'Things to do next', 'woocommerce' ),
			'sort_by' => array(
				array(
					'key'   => 'is_complete',
					'order' => 'asc',
				),
				array(
					'key'   => 'level',
					'order' => 'asc',
				),
			),
			'tasks'   => array(
				'AdditionalPayments',
				'GetMobileApp',
			),
		)
	);

	if ( Features::is_enabled( 'shipping-smart-defaults' ) ) {
		self::add_task(
			'extended',
			new ReviewShippingOptions(
				self::get_list( 'extended' )
			)
		);

		// Tasklist that will never be shown in homescreen,
		// used for having tasks that are accessed by other means.
		self::add_list(
			array(
				'id'           => 'secret_tasklist',
				'hidden_id'    => 'setup',
				'tasks'        => array(
					'ExperimentalShippingRecommendation',
				),
				'event_prefix' => 'secret_tasklist_',
				'visible'      => false,
			)
		);
	}

	if ( has_filter( 'woocommerce_admin_experimental_onboarding_tasklists' ) ) {
		/**
		 * Filter to override default task lists.
		 *
		 * @since 7.4
		 * @param array     $lists Array of tasklists.
		 */
		self::$lists = apply_filters( 'woocommerce_admin_experimental_onboarding_tasklists', self::$lists );
	}
}