You are here

public function LearningPathManagerController::unpublish 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::unpublish()

Make traning unvisible for users with views.

1 string reference to 'LearningPathManagerController::unpublish'
opigno_learning_path.routing.yml in ./opigno_learning_path.routing.yml
opigno_learning_path.routing.yml

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

Code

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