Created
May 22, 2012 08:26
-
-
Save DracoBlue/2767576 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: libs/agavi/filter/AgaviFormPopulationFilter.class.php | |
=================================================================== | |
--- libs/agavi/filter/AgaviFormPopulationFilter.class.php (revision 351) | |
+++ libs/agavi/filter/AgaviFormPopulationFilter.class.php (revision 355) | |
@@ -580,7 +580,22 @@ | |
// now output the remaining incidents | |
// might include errors for cookies, headers and whatnot, but that is okay | |
- if($this->insertErrorMessages($form, $errorMessageRules, $allIncidents)) { | |
+ if($this->insertErrorMessages($form, $errorMessageRules, $allIncidents) && count($allIncidents)) { | |
+ // go over all the elements in the error class map | |
+ foreach($cfg['error_class_map'] as $xpathExpression => $errorClassName) { | |
+ // evaluate each xpath expression | |
+ $errorClassResults = $this->xpath->query(AgaviToolkit::expandVariables($xpathExpression, array('htmlnsPrefix' => $this->xmlnsPrefix)), $form); | |
+ if($errorClassResults && $errorClassResults->length) { | |
+ // we have results. the xpath expressions are used to locale the actual elements we set the error class on - doesn't necessarily have to be the erroneous element or the label! | |
+ foreach($errorClassResults as $errorClassDestinationElement) { | |
+ $errorClassDestinationElement->setAttribute('class', preg_replace('/\s*$/', ' ' . $errorClassName, $errorClassDestinationElement->getAttribute('class'))); | |
+ } | |
+ | |
+ // and break the foreach, our expression matched after all - no need to look further | |
+ break; | |
+ } | |
+ } | |
+ | |
$allIncidents = array(); | |
} | |
} | |
@@ -1051,4 +1066,4 @@ | |
} | |
} | |
-?> | |
\ No newline at end of file | |
+?> |
Added proper name for the .patch file.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Name des Patches: agavi_fix_error_map_class_with_no_field_specific_errors.patch