Automattic\WooCommerce\Admin\Features\OnboardingTasks
TaskList::get_json
Get the list for use in JSON.
Method of the class: TaskList{}
No Hooks.
Returns
Array.
Usage
$TaskList = new TaskList(); $TaskList->get_json();
TaskList::get_json() TaskList::get json code WC 10.5.0
public function get_json() {
$this->possibly_track_completion();
$tasks_json = array();
foreach ( $this->tasks as $task ) {
// We have no use for hidden lists, it's expensive to compute individual tasks completion.
// Exception: Secret tasklist is always hidden, or a task is always accessible.
$list_is_visible = $this->is_visible() || 'secret_tasklist' === $this->id;
if ( $list_is_visible || ( method_exists( $task, 'is_always_accessible' ) && $task->is_always_accessible() ) ) {
$json = $task->get_json();
if ( $json['canView'] ) {
$tasks_json[] = $json;
}
}
}
return array(
'id' => $this->get_list_id(),
'title' => $this->title,
'isHidden' => $this->is_hidden(),
'isVisible' => $this->is_visible(),
'isComplete' => $this->is_complete(),
'tasks' => $tasks_json,
'eventPrefix' => $this->prefix_event( '' ),
'displayProgressHeader' => $this->display_progress_header,
'keepCompletedTaskList' => $this->get_keep_completed_task_list(),
);
}