Skip to content
Permalink
Browse files

ID#347: adapted implementation to status discussed in the tracker.

  • Loading branch information...
ChristianAchatz
ChristianAchatz committed Mar 22, 2019
1 parent 2ff6f3f commit 689cad49c585f8c32fd639f3a87e81c7c9f947e4
Showing with 12 additions and 8 deletions.
  1. +3 −3 tools/form/validator/AbstractFormValidator.php
  2. +9 −5 tools/form/validator/TextFieldValidator.php
@@ -65,13 +65,13 @@ abstract class AbstractFormValidator extends APFObject implements FormValidator
protected static $SPECIAL_VALIDATOR_INDICATOR = 'special';
/**
* Check Validation ONLY by validator attribute
* Indicates that a single listener can be notified by the same validator for multiple form controls.
*
* @var string $SINGLE_VALIDATOR_INDICATOR
* @var string $GENERIC_VALIDATOR_INDICATOR
*
* @since 4.1
*/
protected static $SINGLE_VALIDATOR_INDICATOR = 'single';
protected static $GENERIC_VALIDATOR_INDICATOR = 'generic';
/**
* Includes a reference on the control to validate.
@@ -120,6 +120,8 @@ protected function notifyValidationListeners(FormControl &$control) {
// by the XmlParser. Thus, we can set the validator name to null to
// indicate, that we want a "normal" listener (=no special listener) to be
// notified!
// ID#347: Value "null" for form control indicates that a single listener
// can be notified by the same validator for multiple form controls.
if ($listeners[$i]->getAttribute('control') === $controlName
&& $listeners[$i]->getAttribute('validator') === $validatorName
) {
@@ -139,20 +141,22 @@ protected function notifyValidationListeners(FormControl &$control) {
* Version 0.1, 12.02.2010<br />
*/
protected function getValidatorName() {
if ($this->type === self::$SPECIAL_VALIDATOR_INDICATOR || $this->type === self::$SINGLE_VALIDATOR_INDICATOR) {
if ($this->type === self::$SPECIAL_VALIDATOR_INDICATOR || $this->type === self::$GENERIC_VALIDATOR_INDICATOR) {
return get_class($this);
}
return null;
}
/**git checkout feature
/**
* Evaluates the name of the form control to be used during listener notification.
*
* @param FormControl $control
* @return string Indicates the control name of the listener to notify.
*/
protected function getControlName(FormControl &$control) {
if ($this->type === self::$SINGLE_VALIDATOR_INDICATOR) {
return NULL;
protected function getControlName(FormControl $control) {
if ($this->type === self::$GENERIC_VALIDATOR_INDICATOR) {
return null;
}
return $control->getAttribute('name');

0 comments on commit 689cad4

Please sign in to comment.
You can’t perform that action at this time.