You are here

public static function LearningPathAccess::triggerHookAccess in Opigno Learning path 8

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

Trigger hook accesses.

3 calls to LearningPathAccess::triggerHookAccess()
LearningPathAccess::checkCourseClassAccess in src/LearningPathAccess.php
Returns user course/class access flag.
LearningPathAccess::checkStepValidation in src/LearningPathAccess.php
Returns step user access.
LearningPathAccess::statusGroupValidation in src/LearningPathAccess.php
Returns group user access flag in validation condition.

File

src/LearningPathAccess.php, line 161

Class

LearningPathAccess
Class LearningPathAccess.

Namespace

Drupal\opigno_learning_path

Code

public static function triggerHookAccess($hook_name, $entity, $account) {
  $access = TRUE;
  $access_results = \Drupal::moduleHandler()
    ->invokeAll($hook_name, [
    $entity,
    $account,
  ]);
  if (is_array($access_results)) {
    $access_results = array_filter($access_results, function ($var) {
      return empty($var);
    });
    if (!empty($access_results)) {
      $access = FALSE;
    }
  }
  return $access;
}