Add error class to wrapper if validation errors exist

@param $options
488681
protected function addErrorClass(&$options)
    {
        $errors = $this->formHelper->getRequest()->getSession()->get('errors');

        if ($errors && $errors->has($this->getNameKey())) {
            $errorClass = $this->formHelper->getConfig('defaults.wrapper_error_class');

            if ($options['wrapper'] && !str_contains($options['wrapper']['class'], $errorClass)) {
                $options['wrapper']['class'] .= ' '.$errorClass;
            }
        }

        return $options;
    }
912727
function validateCallbacks(options) {
            if (options.successCallback && typeof options.successCallback !== 'function') {
                throw new Error(TAG + 'Success callback must be a function.');
            } else {
                options.successCallback = options.successCallback || enplug.noop;
            }

            if (options.errorCallback && typeof options.errorCallback !== 'function') {
                throw new Error(TAG + 'Error callback must be a function.');
            } else {
                options.errorCallback = options.errorCallback || enplug.noop;
            }
        }
265090
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        switch ($this->options['type']) {
            case 'isbn-10':
                $isValid = $this->validateIsbn10();
                break;
            case 'isbn-13':
                $isValid = $this->validateIsbn13();
                break;
            default:
                $isValid = $this->validateAuto();
                break;
        }
        return $isValid;
    }
720446
protected function validateFilesystemOptions($options)
	{
		if (preg_match("/:id\b/", $options['url']) !== 1 && preg_match("/:id_partition\b/", $options['url']) !== 1 && preg_match("/:hash\b/", $options['url']) !== 1) {
			throw new Exceptions\InvalidUrlOptionException('Invalid Url: an id, id_partition, or hash interpolation is required.', 1);
		}
	}
1069155
function checkOptions(options) {
                // @TODO: should we throw an error if there are incorrect options provided?
                options = _.pick(options, permittedOptions);

                let validationErrors = utils.validateOptions(options);

                if (_.isEmpty(validationErrors)) {
                    return Promise.resolve(options);
                }

                // For now, we can only handle showing the first validation error
                return Promise.reject(validationErrors[0]);
            }
613610
private static function checkOptions($options)
    {
        if (!isset($options['retries']) || !is_int($options['retries']) || $options['retries'] <= 0) {
            throw new \InvalidArgumentException(
                'retry: the options.retries must be an integer with a positive value'
            );
        }
        if (!isset($options['interval']) || !is_float($options['interval']) || $options['interval'] <= 0.0) {
            throw new \InvalidArgumentException(
                'retry: the options.interval must be a float with a positive value'
            );
        }
    }
1258197
private function validateRequiredFields($options = []) {
		// sort fields
		$fields = $this->sortFieldsForProcessing($this->fields);
		// process fields
		foreach ($fields as $k => $v) {
			if (!empty($options['only_columns']) && !in_array($k, $options['only_columns'])) continue;
			// validate required
			$this->validateRequiredOneField($this->values[$k], $v['options']['error_name'], $v);
		}
		// process details
		if (!empty($this->detail_fields)) {
			foreach ($this->detail_fields as $k => $v) {
				$details = $this->values[$k] ?? [];
				// 1 to 1
				if (!empty($v['options']['details_11'])) {
					$details = [$details];
				}
				// sort fields
				$fields = $this->sortFieldsForProcessing($v['elements'], $v['options']);
				// process details one by one
				foreach ($details as $k2 => $v2) {
					if (!empty($v['options']['details_11'])) {
						$values_key = [$k];
					} else {
						$values_key = [$k, $k2];
					}
					foreach ($fields as $k3 => $v3) {
						// 1 to 1
						if (!empty($v['options']['details_11'])) {
							$v3['options']['values_key'] = [$k, $k3];
							$value = $v2[$k3] ?? null;
							$this->validateRequiredOneField($value, "{$k}[{$k3}]", $v3);
							// put value back into values
							if ($value !== ($v2[$k3] ?? null)) {
								$this->values[$k][$k3] = $value;
							}
						} else { // 1 to M
							$v3['options']['values_key'] = [$k, $k2, $k3];
							$value = $v2[$k3] ?? null;
							$this->validateRequiredOneField($value, "{$k}[{$k2}][{$k3}]", $v3);
							// put value back into values
							if ($value !== ($v2[$k3] ?? null)) {
								$this->values[$k][$k2][$k3] = $value;
							}
						}
					}
					// process subdetails
					if (!empty($v['subdetails'])) {
						foreach ($v['subdetails'] as $k3 => $v3) {
							$subdetails = $v2[$k3] ?? [];
							// sort fields
							$subfields = $this->sortFieldsForProcessing($v3['elements'], $v3['options']);
							// 1 to 1
							if (!empty($v3['options']['details_11'])) {
								$subdetails = [$subdetails];
								$error_values_key = array_merge($values_key, [$k3]);
							} else {
								$error_values_key = array_merge($values_key, [$k3, 1]);
							}
							foreach ($subdetails as $k4 => $v4) {
								// 1 to 1
								if (!empty($v3['options']['details_11'])) {
									$values_key2 = array_merge($values_key, [$k3]);
								} else {
									$values_key2 = array_merge($values_key, [$k3, $k4]);
								}
								foreach ($subfields as $k5 => $v5) {
									// 1 to 1
									if (!empty($v3['options']['details_11'])) {
										$v5['options']['values_key'] = array_merge($values_key2, [$k5]);
										$value = $v4[$k5] ?? null;
										$this->validateRequiredOneField($value, array_to_field($v5['options']['values_key']), $v5);
										// put value back into values
										if ($value !== ($v4[$k5] ?? null)) {
											array_key_set($this->values, $v3['options']['values_key'], $value);
										}
									} else { // 1 to M
										$v5['options']['values_key'] = array_merge($values_key2, [$k5]);
										$value = $v4[$k5] ?? null;
										$this->validateRequiredOneField($value, array_to_field($v5['options']['values_key']), $v5);
										// put value back into values
										if ($value !== ($v4[$k5] ?? null)) {
											array_key_set($this->values, $v3['options']['values_key'], $value);
										}
									}
								}
							}
							// see if subdetail is required, we display
							if (!empty($v3['options']['required']) && empty($subdetails)) {
								// add error to pk
								$counter = 1;
								foreach ($v3['options']['details_pk'] as $v8) {
									if (empty($v3['elements'][$v8]['options']['row_link']) || $v3['elements'][$v8]['options']['row_link'] == $this::HIDDEN) continue;
									$this->error(DANGER, \Object\Content\Messages::REQUIRED_FIELD, $this->parentKeysToErrorName(array_merge($error_values_key,[$v8])));
									$counter++;
								}
								// sometimes pk can be hidden, so we add error to two more
								if ($counter == 1) {
									array_key_sort($v3['elements'], ['row_order' => SORT_ASC, 'order' => SORT_ASC]);
									foreach ($v3['elements'] as $k8 => $v8) {
										if (($v8['options']['required'] ?? '') . '' == '1' && !in_array($k8, $v3['options']['details_pk']) && $counter == 1) {
											$this->error(DANGER, \Object\Content\Messages::REQUIRED_FIELD, $this->parentKeysToErrorName(array_merge($error_values_key,[$k8])));
											$counter++;
										}
									}
								}
							}
						}
					}
				}
				// see if detail is required, we display
				if (!empty($v['options']['required']) && empty($this->values[$k])) {
					// add error to pk
					$counter = 1;
					foreach ($v['options']['details_pk'] as $v8) {
						if (empty($v['elements'][$v8]['options']['row_link']) || $v['elements'][$v8]['options']['row_link'] == $this::HIDDEN) continue;
						$this->error(DANGER, \Object\Content\Messages::REQUIRED_FIELD, "{$k}[1][{$v8}]");
						$counter++;
					}
					// sometimes pk can be hidden, so we add error to two more
					if ($counter == 1) {
						array_key_sort($v['elements'], ['row_order' => SORT_ASC, 'order' => SORT_ASC]);
						foreach ($v['elements'] as $k8 => $v8) {
							if (($v8['options']['required'] ?? '') . '' == '1' && !in_array($k8, $v['options']['details_pk']) && $counter == 1) {
								$this->error(DANGER, \Object\Content\Messages::REQUIRED_FIELD, "{$k}[1][{$k8}]");
								$counter++;
							}
						}
					}
				}
			}
		}
	}
104037
function validateOptions(options) {
  // Validate the schema
  try {
    //console.log(schemas.options);
    return doValidateAdd({
      parameterName: 'options',
      schema: schemas.options,
      newData: options,
      baseSchema: schemas.schema
    });
  } catch (err) {
    // @TODO Add test to see if it was a schema problem rather than options
    //console.log(err);
    if (err.extra && err.extra.parameterName.startsWith('options.schema')) {
      throw new errors.SchemaError(err.message, err.extra);
    }
    throw new errors.OptionsError(err.message, err.extra);
  }
}
1074956
public function setUpConstraints(&$options)
    {
        $constraints = $this->validator->arrayGet($options, 'constraints');
        $model       = $this->config->getDataModel();

        //set up and check the constraints
        if (is_array($constraints) && sizeof($constraints)) {
            $validConstraints = array();

            //iterate over the constraints and only include the valid ones
            foreach ($constraints as $field => $rel) {
                //check if the supplied values are strings and that their methods exist on their respective models
                if (is_string($field) && is_string($rel) && method_exists($model, $field)) {
                    $validConstraints[$field] = $rel;
                }
            }

            $options['constraints'] = $validConstraints;
        }
    }
302150
protected function addError($error){

        $this->valid = false;

        if($error instanceof Exception){
            $this->errors[] = array(
                'file' => $error->getFile(),
                'line' => $error->getLine(),
                'message' => "[".get_class($error)."] ".$error->getMessage()
            );
        }elseif($error instanceof LibXMLError){
            $this->errors[] = array(
                'file' => $error->file,
                'line' => $error->line,
                'message' => "[".get_class($error)."] ".$error->message
            );
        }elseif(is_string($error)){
            $this->errors[] = array(
                'message' => $error
            );
        }
    }
1021429
function validateOptions(options) {
  if (!options) {
    return;
  }

  utils.each(['varControls', 'tagControls', 'cmtControls'], function (key) {
    if (!options.hasOwnProperty(key)) {
      return;
    }
    if (!utils.isArray(options[key]) || options[key].length !== 2) {
      throw new Error('Option "' + key + '" must be an array containing 2 different control strings.');
    }
    if (options[key][0] === options[key][1]) {
      throw new Error('Option "' + key + '" open and close controls must not be the same.');
    }
    utils.each(options[key], function (a, i) {
      if (a.length < 2) {
        throw new Error('Option "' + key + '" ' + ((i) ? 'open ' : 'close ') + 'control must be at least 2 characters. Saw "' + a + '" instead.');
      }
    });
  });

  if (options.hasOwnProperty('cache')) {
    if (options.cache && options.cache !== 'memory') {
      if (!options.cache.get || !options.cache.set) {
        throw new Error('Invalid cache option ' + JSON.stringify(options.cache) + ' found. Expected "memory" or { get: function (key) { ... }, set: function (key, value) { ... } }.');
      }
    }
  }
  if (options.hasOwnProperty('loader')) {
    if (options.loader) {
      if (!options.loader.load || !options.loader.resolve) {
        throw new Error('Invalid loader option ' + JSON.stringify(options.loader) + ' found. Expected { load: function (pathname, cb) { ... }, resolve: function (to, from) { ... } }.');
      }
    }
  }

}
664772
private function isValidOption($option)
    {
        if (array_key_exists($option, $this->options)) {
            return true;
        }

        foreach ($this->encoders as $encoder) {
            if (array_key_exists($option, $encoder->getDefaultOptions())) {
                return true;
            }
        }

        return false;
    }
767296
protected function validate(array $options)
    {
        if (! isset($options['method'])) {
            throw new \InvalidArgumentException('method property is missing');
        } elseif (! in_array($options['method'], ['GET', 'POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE', 'HEAD'])) {
            throw new \InvalidArgumentException('method property is not valid');
        } elseif (! isset($options['path'])) {
            throw new \InvalidArgumentException('path property is missing');
        } elseif (isset($options['since'])
            && ! preg_match('#^' . Application::API_VERSION_REG_EXP . '$#', $options['since'])) {
            throw new \InvalidArgumentException('since property is not valid');
        } elseif (isset($options['until'])
            && ! preg_match('#^' . Application::API_VERSION_REG_EXP . '$#', $options['until'])) {
            throw new \InvalidArgumentException('until property is not valid');
        }
    }
111690
private function validateOptions(array $options) {
        foreach ($options as $key => $value) {
            if (!is_int($key)) return $this->invalidArgumentException('Error while setting a curl option (http://php.net/manual/de/function.curl-setopt.php). Tried to set ' . $key . ' on curl resource.');
        }
        return $this;
    }
743762
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        $validIP = $this->validateIPNumber();
        $validPrivRange = $this->validatePrivateRange();
        $validResRange = $this->validateReservedRange();

        return $validIP && $validPrivRange && $validResRange;
    }
941831
public function validate($class, $data, $mode, array $options = [])
    {
        return $this->validator->validate($class, $data, $mode, true, $options);
    }
100811
function (model, options) {
    var error = options.error;
    options.error = function(resp) {
      if (error) error(model, resp, options);
      model.trigger('error', model, resp, options);
    };
  }