Automattic\WooCommerce\Admin\Features\OnboardingTasks

TaskList::hide()publicWC 1.0

Hide the task list.

Method of the class: TaskList{}

No Hooks.

Return

true|false.

Usage

$TaskList = new TaskList();
$TaskList->hide();

TaskList::hide() code WC 8.6.1

public function hide() {
	if ( $this->is_hidden() ) {
		return;
	}

	$viewable_tasks  = $this->get_viewable_tasks();
	$completed_count = array_reduce(
		$viewable_tasks,
		function( $total, $task ) {
			return $task->is_complete() ? $total + 1 : $total;
		},
		0
	);

	$this->record_tracks_event(
		'completed',
		array(
			'action'                => 'remove_card',
			'completed_task_count'  => $completed_count,
			'incomplete_task_count' => count( $viewable_tasks ) - $completed_count,
		)
	);

	$hidden   = get_option( self::HIDDEN_OPTION, array() );
	$hidden[] = $this->hidden_id ? $this->hidden_id : $this->id;
	$this->maybe_set_default_layout( $hidden );
	return update_option( self::HIDDEN_OPTION, array_unique( $hidden ) );
}