Frontend\Core\Engine\Language::getError PHP Method

getError() public static method

Get an error from the language-file
public static getError ( string $key, boolean $fallback = true ) : string
$key string The key to get.
$fallback boolean Should we provide a fallback in English?
return string
    public static function getError($key, $fallback = true)
    {
        trigger_error('Frontend\\Core\\Engine\\Language is deprecated.
             It has been moved to Frontend\\Core\\Language\\Language', E_USER_DEPRECATED);
        return parent::getError($key, $fallback);
    }

Usage Example

Example #1
0
 /**
  * Validate the form.
  */
 private function validateForm()
 {
     // is the form submitted
     if ($this->frm->isSubmitted()) {
         // get fields
         $txtPassword = $this->frm->getField('password');
         $txtEmail = $this->frm->getField('email');
         // password filled in?
         if ($txtPassword->isFilled(FL::getError('PasswordIsRequired'))) {
             // password correct?
             if (FrontendProfilesAuthentication::getLoginStatus($this->profile->getEmail(), $txtPassword->getValue()) !== FrontendProfilesAuthentication::LOGIN_ACTIVE) {
                 // set error
                 $txtPassword->addError(FL::getError('InvalidPassword'));
             }
             // email filled in?
             if ($txtEmail->isFilled(FL::getError('EmailIsRequired'))) {
                 // valid email?
                 if ($txtEmail->isEmail(FL::getError('EmailIsInvalid'))) {
                     // email already exists?
                     if (FrontendProfilesModel::existsByEmail($txtEmail->getValue(), $this->profile->getId())) {
                         // set error
                         $txtEmail->setError(FL::getError('EmailExists'));
                     }
                 }
             }
         }
         // no errors
         if ($this->frm->isCorrect()) {
             // update email
             FrontendProfilesModel::update($this->profile->getId(), array('email' => $txtEmail->getValue()));
             // trigger event
             FrontendModel::triggerEvent('Profiles', 'after_change_email', array('id' => $this->profile->getId()));
             // redirect
             $this->redirect(SITE_URL . FrontendNavigation::getURLForBlock('Profiles', 'ChangeEmail') . '?sent=true');
         } else {
             $this->tpl->assign('updateEmailHasFormError', true);
         }
     }
 }
All Usage Examples Of Frontend\Core\Engine\Language::getError