Bootstrapper\Form::getFormattedError PHP 메소드

getFormattedError() 공개 메소드

Get the formatted errors for the form element with the given name.
public getFormattedError ( string $name ) : string
$name string
리턴 string
    public function getFormattedError($name)
    {
        if (!$this->hasErrors($name)) {
            // If the form element does not have any errors, return
            // an emptry string.
            return '';
        }
        // Get the errors from the session.
        $errors = $this->getSessionStore()->get('errors');
        // Return the formatted error message, if the form element has any.
        return $errors->first($this->transformKey($name), $this->help(':message'));
    }

Usage Example

예제 #1
0
 /**
  * Get the formatted errors for the form element with the given name.
  *
  * @param string $name
  * @return string 
  * @static 
  */
 public static function getFormattedError($name)
 {
     return \Bootstrapper\Form::getFormattedError($name);
 }