}
for (var i = 0, length = nodeDependencies.length; i < length; i++) {
- // if any dependency is met, the element is visible
- if (nodeDependencies[i].checkDependency()) {
- this._show(dependentNode);
+ // if any dependency is not met, hide the element
+ if (!nodeDependencies[i].checkDependency()) {
+ this._hide(dependentNode);
return;
}
}
- // no node dependency is met
- this._hide(dependentNode);
+ // all node dependency is met
+ this._show(dependentNode);
}.bind(this));
// delete dependencies for removed elements
*/
public function checkDependencies(): bool {
if (!empty($this->dependencies)) {
- $hasMetDependency = false;
foreach ($this->dependencies as $dependency) {
- if ($dependency->checkDependency()) {
- $hasMetDependency = true;
+ if (!$dependency->checkDependency()) {
+ return false;
}
}
-
- if (!$hasMetDependency) {
- return false;
- }
}
if ($this instanceof IFormParentNode) {