You are here

protected static function LearningPathValidator::hasMandatoryItem in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x src/LearningPathValidator.php \Drupal\opigno_learning_path\LearningPathValidator::hasMandatoryItem()

Check if training has at least one mandatory content.

1 call to LearningPathValidator::hasMandatoryItem()
LearningPathValidator::stepsValidate in src/LearningPathValidator.php
Redirect user if one of learning path steps aren't completed.

File

src/LearningPathValidator.php, line 197

Class

LearningPathValidator
Class LearningPathValidator.

Namespace

Drupal\opigno_learning_path

Code

protected static function hasMandatoryItem($contents) {
  foreach ($contents as $content) {
    if ($content
      ->isMandatory()) {
      return TRUE;
    }
  }

  // If training hasn't mandatory entity return FALSE.
  return FALSE;
}