You are here

function CourseObjectFulfillment::setComplete in Course 3.x

Same name and namespace in other branches
  1. 8.3 src/Entity/CourseObjectFulfillment.php \Drupal\course\Entity\CourseObjectFulfillment::setComplete()
  2. 8.2 src/Entity/CourseObjectFulfillment.php \Drupal\course\Entity\CourseObjectFulfillment::setComplete()

Set this fulfillment complete.

Parameters

bool $complete: Set to 0 to un-complete, 1 or omit to complete.

Return value

CourseObjectFulfillment

File

src/Entity/CourseObjectFulfillment.php, line 124

Class

CourseObjectFulfillment
Parent class for course object fulfillment. Unlike Course objects, this is not abstract and can be used when the fulfillment requirements are simple.

Namespace

Drupal\course\Entity

Code

function setComplete($complete = 1) {
  if (!$this
    ->getOption('date_completed')) {
    $this
      ->setOption('date_completed', Drupal::time()
      ->getRequestTime());
  }
  return $this
    ->setOption('complete', $complete);
}