Example #1
0
 /**
  * Wrapper to parent errors, set default translation file
  * @param   string  $file Translation File as set in application/messages/file
  * @param   bool    $translate
  * @return  array   messages
  */
 public function errors($file = NULL, $translate = TRUE)
 {
     if ($file === NULL) {
         $file = self::$defaultTranslation;
     }
     return parent::errors($file, $translate);
 }
Example #2
0
 /**
  * Format error messages from a validation object according to Formo's
  * formatting rules
  *
  * @access public
  * @param Kohana_Validation $validation
  * @return mixed
  */
 public function validation_errors(Kohana_Validation $validation)
 {
     $validation->check();
     $errors = $validation->errors();
     if ($this->driver('is_a_parent')) {
         $array = array();
         foreach ($this->_fields as $field) {
             if ($msg = $field->_error_to_msg($errors)) {
                 $array[$field->alias()] = $field->_error_to_msg($errors);
             }
         }
         return $array;
     } else {
         return $this->_error_to_msg($errors);
     }
 }