Automattic\WooCommerce\Admin\Features\OnboardingTasks

TaskList::hide()publicWC 1.0

Hide the task list.

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

Хуков нет.

Возвращает

true|false.

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

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

Код TaskList::hide() WC 6.4.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;
	return update_option( self::HIDDEN_OPTION, array_unique( $hidden ) );
}