You are here

public function CourseObjectAccessPluginBase::take in Course 3.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/CourseObjectAccessPluginBase.php \Drupal\course\Plugin\CourseObjectAccessPluginBase::take()
  2. 8.2 src/Plugin/CourseObjectAccessPluginBase.php \Drupal\course\Plugin\CourseObjectAccessPluginBase::take()

Can the user take the object?

Parameters

type $account:

Return value

boolean

2 methods override CourseObjectAccessPluginBase::take()
CourseObjectAccessConditional::take in src/Plugin/course/CourseObjectAccess/CourseObjectAccessConditional.php
Can the user take the object?
CourseObjectAccessTiming::take in src/Plugin/course/CourseObjectAccess/CourseObjectAccessTiming.php
Can the user take the object?

File

src/Plugin/CourseObjectAccessPluginBase.php, line 73

Class

CourseObjectAccessPluginBase
Base class for Course object access plugins.

Namespace

Drupal\course\Plugin

Code

public function take($account) {

  // Block access if conditions evaluate.
  $alter = $this
    ->getOption('alter');
  if ($this
    ->evaluate($account) xor !empty($alter['negate'])) {
    if ($alter['access']) {
      return FALSE;
    }
  }
  return TRUE;
}