Automattic\WooCommerce\Admin\Features\OnboardingTasks

TaskList::sort_tasks()publicWC 1.0

Sorts the attached tasks array.

Method of the class: TaskList{}

No Hooks.

Return

TaskList. returns $this, for chaining.

Usage

$TaskList = new TaskList();
$TaskList->sort_tasks( $sort_by );
$sort_by(array)
list of columns with sort order.
Default: array()

TaskList::sort_tasks() code WC 7.1.0

public function sort_tasks( $sort_by = array() ) {
	$sort_by = count( $sort_by ) > 0 ? $sort_by : $this->sort_by;
	if ( 0 !== count( $sort_by ) ) {
		usort(
			$this->tasks,
			function( $a, $b ) use ( $sort_by ) {
				return Task::sort( $a, $b, $sort_by );
			}
		);
	}
	return $this;
}