You are here

public function LearningPathResults::delete in Opigno Learning path 3.x

Same name and namespace in other branches
  1. 8 src/Controller/LearningPathResults.php \Drupal\opigno_learning_path\Controller\LearningPathResults::delete()

Delete a result and redirect the user to the results page.

File

src/Controller/LearningPathResults.php, line 69

Class

LearningPathResults
Class LearningPathResults.

Namespace

Drupal\opigno_learning_path\Controller

Code

public function delete(Group $group, LPResult $result) {
  $result
    ->delete();
  $roles = \Drupal::currentUser()
    ->getRoles();
  if (array_search('administrator', $roles) === FALSE) {
    drupal_flush_all_caches();
  }
  return $this
    ->redirect('opigno_learning_path.results', [
    'group' => $group
      ->id(),
  ]);
}