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