Task
in package
Uses
TaskTraits
Task class.
Table of Contents
- ACTIONED_OPTION = 'woocommerce_task_list_tracked_completed_actions'
- Name of the actioned option.
- ACTIVE_TASK_TRANSIENT = 'wc_onboarding_active_task'
- Name of the active task transient.
- COMPLETED_OPTION = 'woocommerce_task_list_tracked_completed_tasks'
- Option name of completed tasks.
- DISMISSED_OPTION = 'woocommerce_task_list_dismissed_tasks'
- Name of the dismiss option.
- SNOOZED_OPTION = 'woocommerce_task_list_remind_me_later_tasks'
- Name of the snooze option.
- $duration_to_ms : string
- Duration to milisecond mapping.
- $task_list : TaskList
- Parent task list.
- __construct() : mixed
- Constructor
- can_view() : bool
- Check if the store is capable of viewing the task.
- convert_object_to_camelcase() : object
- Convert object keys to camelcase.
- dismiss() : bool
- Dismiss the task.
- get_action_label() : string
- Action label.
- get_action_url() : string
- Action URL.
- get_additional_data() : mixed
- Additional data.
- get_additional_info() : string
- Additional info.
- get_badge() : string
- Badge.
- get_content() : string
- Content.
- get_id() : string
- ID.
- get_json() : array<string|int, mixed>
- Get the task as JSON.
- get_level() : string
- Level.
- get_list_id() : string
- Get the task list ID.
- get_parent_id() : string
- Parent ID.
- get_parent_option() : mixed|null
- Get custom option.
- get_parent_options() : array<string|int, mixed>
- Get task list options.
- get_record_view_event() : bool
- Check if should record event when task is viewed
- get_snoozed_until() : string
- Get the snoozed until datetime.
- get_time() : string
- Time.
- get_title() : string
- Title.
- has_previously_completed() : bool
- Check if a task list has previously been marked as complete.
- is_actioned() : bool
- Check if a task has been actioned.
- is_active() : mixed
- Check if this is the active task.
- is_complete() : bool
- Check if the task is complete.
- is_disabled() : bool
- Check if task is disabled.
- is_dismissable() : bool
- Check if a task is dismissable.
- is_dismissed() : bool
- Bool for task dismissal.
- is_snoozeable() : bool
- Check if a task is snoozeable.
- is_snoozed() : bool
- Bool for task snoozed.
- is_task_actioned() : bool
- Check if a provided task ID has been actioned.
- is_visited() : bool
- Check if the task has been visited.
- mark_actioned() : bool
- Mark a task as actioned. Used to verify an action has taken place in some tasks.
- possibly_track_completion() : mixed
- Track task completion if task is viewable.
- prefix_event() : string
- Prefix event for track event naming.
- record_tracks_event() : string
- Record a tracks event with the prefixed event name.
- set_active() : mixed
- Set this as the active task across page loads.
- snooze() : bool
- Snooze the task.
- sort() : int
- Sorting function for tasks.
- undo_dismiss() : bool
- Undo task dismissal.
- undo_snooze() : bool
- Undo task snooze.
Constants
ACTIONED_OPTION
Name of the actioned option.
public
string
ACTIONED_OPTION
= 'woocommerce_task_list_tracked_completed_actions'
ACTIVE_TASK_TRANSIENT
Name of the active task transient.
public
string
ACTIVE_TASK_TRANSIENT
= 'wc_onboarding_active_task'
COMPLETED_OPTION
Option name of completed tasks.
public
string
COMPLETED_OPTION
= 'woocommerce_task_list_tracked_completed_tasks'
DISMISSED_OPTION
Name of the dismiss option.
public
string
DISMISSED_OPTION
= 'woocommerce_task_list_dismissed_tasks'
SNOOZED_OPTION
Name of the snooze option.
public
string
SNOOZED_OPTION
= 'woocommerce_task_list_remind_me_later_tasks'
Tags
Properties
$duration_to_ms
Duration to milisecond mapping.
protected
string
$duration_to_ms
= array('day' => DAY_IN_SECONDS * 1000, 'hour' => HOUR_IN_SECONDS * 1000, 'week' => WEEK_IN_SECONDS * 1000)
$task_list
Parent task list.
protected
TaskList
$task_list
Methods
__construct()
Constructor
public
__construct([TaskList|null $task_list = null ]) : mixed
Parameters
- $task_list : TaskList|null = null
-
Parent task list.
Return values
mixed —can_view()
Check if the store is capable of viewing the task.
public
can_view() : bool
Return values
bool —convert_object_to_camelcase()
Convert object keys to camelcase.
public
static convert_object_to_camelcase(array<string|int, mixed> $data) : object
Parameters
- $data : array<string|int, mixed>
-
Data to convert.
Return values
object —dismiss()
Dismiss the task.
public
dismiss() : bool
Return values
bool —get_action_label()
Action label.
public
get_action_label() : string
Return values
string —get_action_url()
Action URL.
public
get_action_url() : string
Return values
string —get_additional_data()
Additional data.
public
get_additional_data() : mixed
Return values
mixed —get_additional_info()
Additional info.
public
get_additional_info() : string
Return values
string —get_badge()
Badge.
public
get_badge() : string
Return values
string —get_content()
Content.
public
abstract get_content() : string
Return values
string —get_id()
ID.
public
abstract get_id() : string
Return values
string —get_json()
Get the task as JSON.
public
get_json() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_level()
Level.
public
get_level() : string
Tags
Return values
string —get_list_id()
Get the task list ID.
public
get_list_id() : string
Return values
string —get_parent_id()
Parent ID.
public
get_parent_id() : string
Return values
string —get_parent_option()
Get custom option.
public
get_parent_option(string $option_name) : mixed|null
Parameters
- $option_name : string
-
name of custom option.
Return values
mixed|null —get_parent_options()
Get task list options.
public
get_parent_options() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_record_view_event()
Check if should record event when task is viewed
public
get_record_view_event() : bool
Return values
bool —get_snoozed_until()
Get the snoozed until datetime.
public
get_snoozed_until() : string
Tags
Return values
string —get_time()
Time.
public
abstract get_time() : string
Return values
string —get_title()
Title.
public
abstract get_title() : string
Return values
string —has_previously_completed()
Check if a task list has previously been marked as complete.
public
has_previously_completed() : bool
Return values
bool —is_actioned()
Check if a task has been actioned.
public
is_actioned() : bool
Return values
bool —is_active()
Check if this is the active task.
public
is_active() : mixed
Return values
mixed —is_complete()
Check if the task is complete.
public
is_complete() : bool
Return values
bool —is_disabled()
Check if task is disabled.
public
is_disabled() : bool
Tags
Return values
bool —is_dismissable()
Check if a task is dismissable.
public
is_dismissable() : bool
Return values
bool —is_dismissed()
Bool for task dismissal.
public
is_dismissed() : bool
Return values
bool —is_snoozeable()
Check if a task is snoozeable.
public
is_snoozeable() : bool
Tags
Return values
bool —is_snoozed()
Bool for task snoozed.
public
is_snoozed() : bool
Tags
Return values
bool —is_task_actioned()
Check if a provided task ID has been actioned.
public
static is_task_actioned(string $id) : bool
Parameters
- $id : string
-
Task ID.
Return values
bool —is_visited()
Check if the task has been visited.
public
is_visited() : bool
Return values
bool —mark_actioned()
Mark a task as actioned. Used to verify an action has taken place in some tasks.
public
mark_actioned() : bool
Return values
bool —possibly_track_completion()
Track task completion if task is viewable.
public
possibly_track_completion() : mixed
Return values
mixed —prefix_event()
Prefix event for track event naming.
public
prefix_event(string $event_name) : string
Parameters
- $event_name : string
-
Event name.
Return values
string —record_tracks_event()
Record a tracks event with the prefixed event name.
public
record_tracks_event(string $event_name[, array<string|int, mixed> $args = array() ]) : string
Parameters
- $event_name : string
-
Event name.
- $args : array<string|int, mixed> = array()
-
Array of tracks arguments.
Return values
string — Prefixed event name.set_active()
Set this as the active task across page loads.
public
set_active() : mixed
Return values
mixed —snooze()
Snooze the task.
public
snooze([string $duration = 'day' ]) : bool
Parameters
- $duration : string = 'day'
-
Duration to snooze. day|hour|week.
Tags
Return values
bool —sort()
Sorting function for tasks.
public
static sort(Task $a, Task $b[, array<string|int, mixed> $sort_by = array() ]) : int
Parameters
- $a : Task
-
Task a.
- $b : Task
-
Task b.
- $sort_by : array<string|int, mixed> = array()
-
list of columns with sort order.
Return values
int —undo_dismiss()
Undo task dismissal.
public
undo_dismiss() : bool
Return values
bool —undo_snooze()
Undo task snooze.
public
undo_snooze() : bool