} } /** * Removes an item from the extended task list. * * @param mixed $task_name Task name to remove. */ public static function remove_extended_task_list_item( $task_name ) { if ( $task_name ) { $extended_tasks_list_items = get_option( 'woocommerce_extended_task_list_items', array() ); if ( in_array( $task_name, $extended_tasks_list_items, true ) ) { array_push( $extended_tasks_list_items, $task_name ); $tasks_list_items = array_diff( $extended_tasks_list_items, array( $task_name ) ); update_option( 'woocommerce_extended_task_list_items', $tasks_list_items ); } } } /** * Records an event for individual task completion. * * @param mixed $old_value Old value. * @param mixed $new_value New value. */ public static function track_task_completion( $old_value, $new_value ) { $old_value = is_array( $old_value ) ? $old_value : array(); $untracked_tasks = array_diff( $new_value, $old_value ); foreach ( $untracked_tasks as $task ) { wc_admin_record_tracks_event( 'tasklist_task_completed', array( 'task_name' => $task ) ); } } }