Frontend\Core\Language\Language::err PHP Метод

err() публичный статический Метод

Get an error from the language-file
public static err ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
Результат string
    public static function err($key, $fallback = true)
    {
        return self::getError($key, $fallback);
    }

Usage Example

Пример #1
0
 /**
  * Validate the form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         // validate required fields
         $this->frm->getField('name')->isFilled(FL::err('NameIsRequired'));
         $this->frm->getField('email')->isEmail(FL::err('EmailIsInvalid'));
         $this->frm->getField('message')->isFilled(FL::err('QuestionIsRequired'));
         if ($this->frm->isCorrect()) {
             $spamFilterEnabled = $this->get('fork.settings')->get('Faq', 'spamfilter');
             $variables['sentOn'] = time();
             $variables['name'] = $this->frm->getField('name')->getValue();
             $variables['email'] = $this->frm->getField('email')->getValue();
             $variables['message'] = $this->frm->getField('message')->getValue();
             if ($spamFilterEnabled) {
                 // if the comment is spam alter the comment status so it will appear in the spam queue
                 if (FrontendModel::isSpam($variables['message'], SITE_URL . FrontendNavigation::getURLForBlock('Faq'), $variables['name'], $variables['email'])) {
                     $this->status = 'errorSpam';
                     return;
                 }
             }
             $from = $this->get('fork.settings')->get('Core', 'mailer_from');
             $to = $this->get('fork.settings')->get('Core', 'mailer_to');
             $replyTo = $this->get('fork.settings')->get('Core', 'mailer_reply_to');
             $message = Message::newInstance(sprintf(FL::getMessage('FaqOwnQuestionSubject'), $variables['name']))->setFrom(array($from['email'] => $from['name']))->setTo(array($to['email'] => $to['name']))->setReplyTo(array($replyTo['email'] => $replyTo['name']))->parseHtml('/Faq/Layout/Templates/Mails/OwnQuestion.html.twig', $variables, true);
             $this->get('mailer')->send($message);
             $this->status = 'success';
         }
     }
 }
All Usage Examples Of Frontend\Core\Language\Language::err