errorMessage() 공개 정적인 메소드

Errors are stored with either a message or a translation code. This method will look at both to determine the full message.
public static errorMessage ( array $error ) : string
$error array The error array.
리턴 string Returns the message from the error.
예제 #1
0
 /**
  * Specify data which should be serialized to JSON.
  *
  * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
  * @return mixed data which can be serialized by <b>json_encode</b>,
  * which is a value of any type other than a resource.
  */
 public function jsonSerialize()
 {
     $errors = $this->validation->getErrorsFlat();
     if (count($errors) === 1) {
         $message = Validation::errorMessage($errors[0]);
     } else {
         $message = t('Validation failed.');
     }
     $result = ['message' => $message, 'status' => $this->getCode(), 'errors' => $errors];
     return $result;
 }