public function LearningPathManagerController::unpublish in Opigno Learning path 8
Same name and namespace in other branches
- 3.x src/Controller/LearningPathManagerController.php \Drupal\opigno_learning_path\Controller\LearningPathManagerController::unpublish()
Make traning unvisible for users with views.
1 string reference to 'LearningPathManagerController::unpublish'
File
- src/
Controller/ LearningPathManagerController.php, line 565
Class
- LearningPathManagerController
- Controller for all the actions of the Learning Path manager app.
Namespace
Drupal\opigno_learning_path\ControllerCode
public function unpublish(Group $group) {
if ($group->field_learning_path_published->value == 0) {
// Skip.
}
else {
$group
->set('field_learning_path_published', 0);
$group
->save();
}
return $this
->redirect('entity.group.canonical', [
'group' => $group
->id(),
]);
}