Index: trunk/extensions/Validator/includes/ValidationErrorHandler.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | * @param integer $severity |
30 | 30 | */ |
31 | 31 | public static function addError( ValidationError $error ) { |
32 | | - self::$errors[$error->element ? $error->element : 'unknown'][] = $error; |
| 32 | + self::$errors[$error->getElement()][] = $error; |
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
Index: trunk/extensions/Validator/includes/ValidationError.php |
— | — | @@ -72,6 +72,17 @@ |
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
| 76 | + * Returns the element this error occured at, or 'unknown' when i's unknown. |
| 77 | + * |
| 78 | + * @since 0.4 |
| 79 | + * |
| 80 | + * @return string |
| 81 | + */ |
| 82 | + public function getElement() { |
| 83 | + return $this->element === false ? 'unknown' : $this->element; |
| 84 | + } |
| 85 | + |
| 86 | + /** |
76 | 87 | * Returns the severity of the error. |
77 | 88 | * |
78 | 89 | * @since 0.4 |
Index: trunk/extensions/Validator/includes/parserHooks/Validator_ListErrors.php |
— | — | @@ -128,7 +128,7 @@ |
129 | 129 | if ( count( $errors ) == 0 ) { |
130 | 130 | return ''; |
131 | 131 | } |
132 | | - |
| 132 | + |
133 | 133 | $elements = array_keys( $errors ); |
134 | 134 | natcasesort( $elements ); |
135 | 135 | |
Index: trunk/extensions/Validator/includes/ParserHook.php |
— | — | @@ -226,7 +226,8 @@ |
227 | 227 | public function validateAndRender( array $arguments, $type ) { |
228 | 228 | global $egValidatorErrorLevel; |
229 | 229 | |
230 | | - $this->validator = new Validator( $this->getName() ); |
| 230 | + $names = $this->getNames(); |
| 231 | + $this->validator = new Validator( $names[0] ); |
231 | 232 | |
232 | 233 | if ( $type === self::TYPE_FUNCTION ) { |
233 | 234 | $this->validator->setFunctionParams( $arguments, $this->getParameterInfo( $type ), $this->getDefaultParameters( $type ) ); |
Index: trunk/extensions/Validator/includes/Parameter.php |
— | — | @@ -358,8 +358,8 @@ |
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
| 362 | + * Sets and cleans the original value and name. |
362 | 363 | * |
363 | | - * |
364 | 364 | * @since 0.4 |
365 | 365 | * |
366 | 366 | * @param string $paramName |
Index: trunk/extensions/Validator/includes/Validator.php |
— | — | @@ -188,6 +188,7 @@ |
189 | 189 | * @param ValidationError $error |
190 | 190 | */ |
191 | 191 | protected function registerError( ValidationError $error ) { |
| 192 | + $error->element = $this->element; |
192 | 193 | $this->errors[] = $error; |
193 | 194 | ValidationErrorHandler::addError( $error ); |
194 | 195 | } |