public function CourseObjectAccessPluginBase::alterOptions in Course 3.x
Alter a property during display/tracking. Does not affect the stored options. This is called in CourseObject::getReadOnlyOptions().
Parameters
array $property: Array of object options.
object $account: User account to evaluate.
File
- src/
Plugin/ CourseObjectAccessPluginBase.php, line 115
Class
- CourseObjectAccessPluginBase
- Base class for Course object access plugins.
Namespace
Drupal\course\PluginCode
public function alterOptions(&$options, $account) {
$alter = $this
->getOption('alter');
if ($this
->evaluate($account) xor !empty($alter['negate'])) {
// Conditions passed. Apply modifications.
if (isset($alter['required']) && $alter['required'] != -1) {
$options['required'] = $alter['required'];
}
if (isset($alter['visible']) && $alter['visible'] != -1) {
$options['hidden'] = !$alter['visible'];
}
}
}