You are here

public function LearningPathManagerController::publish in Opigno Learning path 8

Same name and namespace in other branches
  1. 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'
opigno_learning_path.routing.yml in ./opigno_learning_path.routing.yml
opigno_learning_path.routing.yml

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\Controller

Code

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(),
  ]);
}