30 if (0 === count($errors)) {
34 $errorsToDisplay = [];
35 foreach ($errors as $error) {
36 $translation = $this->lng->txt($error->getLanguageVariable());
37 if ($translation ===
'-' . $this->lng->txt($error->getLanguageVariable()) .
'-') {
38 $translation = $error->getLanguageVariable();
42 0 === count($error->getPlaceHolderValues()) ||
43 $translation === $error->getLanguageVariable()
45 $errorsToDisplay[] = $translation;
47 $escapedPlaceholderValues = array_map(
function (
string $address) {
48 return \ilUtil::prepareFormOutput($address);
49 }, $error->getPlaceHolderValues());
51 array_unshift($escapedPlaceholderValues, $translation);
52 $errorsToDisplay[] = call_user_func_array(
'sprintf', $escapedPlaceholderValues);
56 if (0 === count($errorsToDisplay)) {
60 $tpl = new \ilTemplate(
'tpl.mail_new_submission_errors.html',
true,
true,
'Services/Mail');
61 if (1 === count($errorsToDisplay)) {
62 $tpl->setCurrentBlock(
'single_error');
63 $tpl->setVariable(
'SINGLE_ERROR', current($errorsToDisplay));
64 $tpl->parseCurrentBlock();
66 $firstError = array_shift($errorsToDisplay);
68 foreach ($errorsToDisplay as $error) {
69 $tpl->setCurrentBlock(
'error_loop');
70 $tpl->setVariable(
'ERROR', $error);
71 $tpl->parseCurrentBlock();
74 $tpl->setCurrentBlock(
'multiple_errors');
75 $tpl->setVariable(
'FIRST_ERROR', $firstError);
76 $tpl->parseCurrentBlock();