Skip to content

Commit

Permalink
Merge pull request FluidTYPO3#291 from NamelessCoder/hasvalidator
Browse files Browse the repository at this point in the history
[TASK] Make Form / HasValidator condition validatorName optional
  • Loading branch information
bjo3rnf committed Aug 7, 2013
2 parents ddbc3a8 + 861a2cf commit 75efd43
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/ViewHelpers/If/Form/HasValidatorViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function injectOwnReflectionService(Tx_Extbase_Reflection_Service $reflec
* @param Tx_Extbase_DomainObject_DomainObjectInterface $object Optional object - if not specified, grabs the associated form object
* @return string
*/
public function render($property, $validatorName, Tx_Extbase_DomainObject_DomainObjectInterface $object = NULL) {
public function render($property, $validatorName = NULL, Tx_Extbase_DomainObject_DomainObjectInterface $object = NULL) {
if ($object === NULL) {
$object = $this->getFormObject();
$className = get_class($object);
Expand All @@ -91,7 +91,7 @@ public function render($property, $validatorName, Tx_Extbase_DomainObject_Domain
}
}
$annotations = $this->ownReflectionService->getPropertyTagValues($className, $property, 'validate');
if (in_array('NotEmpty', $annotations) === TRUE) {
if (0 < count($annotations) && (NULL === $validatorName || in_array($validatorName, $annotations) === TRUE)) {
return $this->renderThenChild();
}
return $this->renderElseChild();
Expand Down

0 comments on commit 75efd43

Please sign in to comment.