You are here

public function CourseHandler::setAccessMessage in Course 3.x

Same name and namespace in other branches
  1. 8.3 src/Helper/CourseHandler.php \Drupal\course\Helper\CourseHandler::setAccessMessage()
  2. 8.2 src/Helper/CourseHandler.php \Drupal\course\Helper\CourseHandler::setAccessMessage()

Set an access message to be displayed along with the course object when it is in the outline. For example, "This activity will open on XYZ" or "Please complete Step 1 to take this activity."

Parameters

string $key: Message key.

string $message: Message text.

1 call to CourseHandler::setAccessMessage()
CourseHandler::getAccessMessages in src/Helper/CourseHandler.php
Get an array of access messages.

File

src/Helper/CourseHandler.php, line 214

Class

CourseHandler
Master class for a course related content entity.

Namespace

Drupal\course\Helper

Code

public function setAccessMessage($key = NULL, $message = NULL) {
  if ($key == NULL) {
    return $this->accessMessages;
  }
  if (empty($message)) {
    unset($this->accessMessages[$key]);
  }
  else {
    $this->accessMessages[$key] = $message;
  }
}