Automattic\WooCommerce\Admin\Features\OnboardingTasks

TaskList::__construct()publicWC 1.0

Constructor

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

No Hooks.

Return

null. Nothing.

Usage

$TaskList = new TaskList();
$TaskList->__construct( $data );
$data(array)
Task list data.
Default: array()

Code of TaskList::__construct() WC 6.6.1

public function __construct( $data = array() ) {
	$defaults = array(
		'id'                      => null,
		'hidden_id'               => null,
		'title'                   => '',
		'tasks'                   => array(),
		'sort_by'                 => array(),
		'event_prefix'            => null,
		'options'                 => array(),
		'visible'                 => true,
		'display_progress_header' => false,
		'sections'                => array(),
	);

	$data = wp_parse_args( $data, $defaults );

	$this->id                      = $data['id'];
	$this->hidden_id               = $data['hidden_id'];
	$this->title                   = $data['title'];
	$this->sort_by                 = $data['sort_by'];
	$this->event_prefix            = $data['event_prefix'];
	$this->options                 = $data['options'];
	$this->visible                 = $data['visible'];
	$this->display_progress_header = $data['display_progress_header'];

	foreach ( $data['tasks'] as $task_name ) {
		$class = 'Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\\' . $task_name;
		$task  = new $class( $this );
		$this->add_task( $task );
	}

	$this->possibly_remove_reminder_bar();
	$this->sections = array_map(
		function( $section ) {
			return new TaskListSection( $section, $this );
		},
		$data['sections']
	);
}