You are here

protected function UpdateChecklist::checkListPoints in Update helper 8

Same name and namespace in other branches
  1. 2.x modules/update_helper_checklist/src/UpdateChecklist.php \Drupal\update_helper_checklist\UpdateChecklist::checkListPoints()

Checks an array of bulletpoints on a checklist.

Parameters

array $update_ids: Array of the bulletpoints.

1 call to UpdateChecklist::checkListPoints()
UpdateChecklist::markUpdatesSuccessful in modules/update_helper_checklist/src/UpdateChecklist.php
Marks a list of updates as successful.

File

modules/update_helper_checklist/src/UpdateChecklist.php, line 195

Class

UpdateChecklist
Update checklist service.

Namespace

Drupal\update_helper_checklist

Code

protected function checkListPoints(array $update_ids) {
  $current_progress = $this->checkListStateStorage
    ->setChecklistId('update_helper_checklist')
    ->getSavedProgress();
  $user = $this->account
    ->id();
  $time = time();
  foreach ($update_ids as $update_id) {
    if (empty($current_progress['#items'][$update_id])) {
      $current_progress['#items'][$update_id] = [
        '#completed' => time(),
        '#uid' => $user,
      ];
    }
  }
  $current_progress['#completed_items'] = count($current_progress['#items']);
  $current_progress['#changed'] = $time;
  $current_progress['#changed_by'] = $user;
  $this->checkListStateStorage
    ->setChecklistId('update_helper_checklist')
    ->setSavedProgress($current_progress);
}