protected function LearningPathStepsController::requiredStepMessage in Opigno Learning path 3.x
Same name and namespace in other branches
- 8 src/Controller/LearningPathStepsController.php \Drupal\opigno_learning_path\Controller\LearningPathStepsController::requiredStepMessage()
Provide the required step messages.
Parameters
string $name: Step name.
int $required: Minimum score.
string $link: Link to try again.
Return value
string Message.
2 calls to LearningPathStepsController::requiredStepMessage()
- LearningPathStepsController::getNextStep in src/
Controller/ LearningPathStepsController.php - Redirect the user to the next step.
- LearningPathStepsController::start in src/
Controller/ LearningPathStepsController.php - Start the learning path.
File
- src/
Controller/ LearningPathStepsController.php, line 820
Class
- LearningPathStepsController
- Class LearningPathStepsController.
Namespace
Drupal\opigno_learning_path\ControllerCode
protected function requiredStepMessage($name, $required = NULL, $link = '') {
if (empty($required)) {
// The simple message.
return $this
->t('A required step: %step should be done first.', [
'%step' => $name,
]);
}
else {
$text = 'You should first get a minimum score of %required to the step %step before going further.';
if (!empty($link)) {
return $this
->t("{$text} <a href=':link'>Try again.</a>", [
'%step' => $name,
'%required' => $required,
':link' => $link,
]);
}
else {
return $this
->t("{$text}", [
'%step' => $name,
'%required' => $required,
]);
}
}
}