Performs full language data validation
@param array $submitted
@param array $options
@return array|boolean
8386
public function language(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateLanguage();
        $this->validateWeight();
        $this->validateBool('status');
        $this->validateBool('default');
        $this->validateNameLanguage();
        $this->validateNativeNameLanguage();
        $this->validateCodeLanguage();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
429030
public function resetPassword(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $email = $this->getSubmitted('email');
        $password = $this->getSubmitted('password');

        if (isset($password)) {
            $this->validateStatusUser();
            $this->validatePasswordLengthUser();
        } else if (isset($email)) {
            $this->validateEmail();
            $this->validateEmailExistsUser();
        }

        return $this->getResult();
    }
132385
public function isValid($value = null, array $options = []): bool
    {
        $this->setOptions($options);
        $this->setValue(\str_replace(['-', ' '], '', $value));
        $this->errors = [];

        return $this->validateNip();
    }
689870
public function zone(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateZone();
        $this->validateBool('status');
        $this->validateTitle();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
876159
public function numeric(array $submitted, array $options)
    {
        $options += array(
            'field' => null,
            'label' => null
        );

        $value = gplcart_array_get($submitted, $options['field']);

        if (is_numeric($value)) {
            return true;
        }

        return $this->setErrorNumeric($options['field'], $options['label']);
    }
118005
public function validateRename(&$submitted, $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateNameRename();
        $this->validateDestinationRename();

        return $this->getResult();
    }
474180
public function productClassField(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateProductClassField();
        $this->validateProductClassProductClassField();
        $this->validateWeight();
        $this->validateBool('required');
        $this->validateBool('multiple');
        $this->validateFieldIdProductClassField();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
674435
public function validateSubmitButtons($options = []) {
		$buttons_found = [];
		$names = [];
		foreach ($this->data as $k => $v) {
			foreach (($v['rows'] ?? []) as $k2 => $v2) {
				// find all process submit buttons
				foreach ($v2['elements'] as $k3 => $v3) {
					if (!empty($v3['options']['process_submit'])) {
						if (!isset($buttons_found[$k3])) {
							$buttons_found[$k3] = [];
						}
						$buttons_found[$k3][] = [
							'name' => $v3['options']['value'],
							'key' => [$k, 'rows', $k2, 'elements', $k3]
						];
						$names[$k3] = $v3['options']['value'];
					}
				}
			}
		}
		// validations
		if (!empty($this->buttons_model)) {
			// make a call to master object
			$result = $this->buttons_model->processButtons($this, [
				'skip_validation' => $options['skip_validation'] ?? false
			]);
			$not_allowed = $result['not_allowed'];
			$also_set_save = $result['also_set_save'];
			$all_standard_buttons = $result['all_buttons'];
		} else { // standard buttons
			$all_standard_buttons = [
				self::BUTTON_SUBMIT,
				self::BUTTON_SUBMIT_SAVE,
				self::BUTTON_SUBMIT_SAVE_AND_NEW,
				self::BUTTON_SUBMIT_SAVE_AND_CLOSE,
				self::BUTTON_SUBMIT_RESET,
				self::BUTTON_SUBMIT_DELETE,
				self::BUTTON_CONTINUE,
				self::BUTTON_STOP,
			];
			// process
			$not_allowed = [];
			$show_save_buttons = false;
			if (!empty($this->options['acl_subresource_edit'])) {
				// remove delete buttons if we do not have loaded values or do not have permission
				if (!$this->values_loaded || (empty($this->options['skip_acl']) && !$this->tempProcessACLSubresources($this->options['acl_subresource_edit'], 'Record_Delete'))) {
					$not_allowed[] = self::BUTTON_SUBMIT_DELETE;
				}
				// we need to check permissions
				if (!$this->values_loaded && (empty($this->options['skip_acl']) && $this->tempProcessACLSubresources($this->options['acl_subresource_edit'], 'Record_New'))) {
					$show_save_buttons = true;
				}
				if ($this->values_loaded && (empty($this->options['skip_acl']) && $this->tempProcessACLSubresources($this->options['acl_subresource_edit'], 'Record_Edit'))) {
					$show_save_buttons = true;
				}
			} else {
				// remove delete buttons if we do not have loaded values or do not have permission
				if (!$this->values_loaded || (empty($this->options['skip_acl']) && !\Application::$controller->can('Record_Delete', 'Edit'))) {
					$not_allowed[] = self::BUTTON_SUBMIT_DELETE;
				}
				// we need to check permissions
				if (!$this->values_loaded && (empty($this->options['skip_acl']) && \Application::$controller->can('Record_New', 'Edit'))) {
					$show_save_buttons = true;
				}
				if ($this->values_loaded && (empty($this->options['skip_acl']) && \Application::$controller->can('Record_Edit', 'Edit'))) {
					$show_save_buttons = true;
				}
			}
			if (!$show_save_buttons && empty($this->options['skip_acl'])) {
				$not_allowed[] = self::BUTTON_SUBMIT_SAVE;
				$not_allowed[] = self::BUTTON_SUBMIT_SAVE_AND_NEW;
				$not_allowed[] = self::BUTTON_SUBMIT_SAVE_AND_CLOSE;
				// if we need to make form readonly
				if (!empty($this->options['readonly_if_cannot_edit'])) {
					$this->readonly();
				}
			}
			// these buttons are considered save
			$also_set_save = [
				self::BUTTON_SUBMIT,
				self::BUTTON_SUBMIT_SAVE_AND_NEW,
				self::BUTTON_SUBMIT_SAVE_AND_CLOSE,
				self::BUTTON_SUBMIT_DELETE,
				self::BUTTON_SUBMIT_OTHER_DELETE,
				self::BUTTON_CONTINUE,
				self::BUTTON_STOP
			];
		}
		// validate if we have that button
		$result = true;
		foreach ($buttons_found as $k => $v) {
			if (empty($this->process_submit[$k])) {
				unset($this->process_submit[$k]);
			} else if (empty($buttons_found[$k]) || (!in_array($k, $all_standard_buttons) && empty($this->process_submit_other[$k])) || in_array($k, $not_allowed)) {
				// if we have validation
				if (empty($options['skip_validation'])) {
					$this->error('danger', 'Form action [action] is not allowed!', null, ['replace' => ['[action]' => i18n(null, $names[$k])]]);
					$result = false;
				}
				unset($this->process_submit[$k]);
			}
			// hide it
			if (!empty($options['skip_validation'])) {
				if (!empty($buttons_found[$k]) && in_array($k, $not_allowed)) {
					foreach ($buttons_found[$k] as $v2) {
						// we disable buttons in test mode
						if (\Application::get('flag.numbers.frontend.html.form.show_field_settings')) {
							$temp = array_key_get($this->data, $v2['key']);
							$temp['options']['class'] = ($temp['options']['class'] ?? '') . ' disabled';
							array_key_set($this->data, $v2['key'], $temp);
						} else { // remove in regular mode
							array_key_get($this->data, $v2['key'], ['unset' => true]);
						}
					}
				}
			}
		}
		if ($this->submitted) {
			$this->misc_settings['__original_submitted'] = true;
		}
		$this->submitted = !empty($this->process_submit);
		// fix for save
		foreach ($also_set_save as $v) {
			if (!empty($this->process_submit[$v])) {
				$this->process_submit[self::BUTTON_SUBMIT_SAVE] = true;
			}
		}
		return $result;
	}
432878
public function imageStyle(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateImageStyle();
        $this->validateName();
        $this->validateBool('status');
        $this->validateActionsImageStyle();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
310492
function validate($value, $key, $fields, $options, $exists, \CharlotteDunois\Validation\Validator $validator) {
        if(!$exists) {
            return false;
        }
        
        $n = \explode(',', $options);
        if(!\in_array($value, $n)) {
            return array('formvalidator_make_in', array('{0}' => $options));
        }
        
        return true;
    }
531437
public function product(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateProduct();
        $this->validateSubtractProduct();
        $this->validateBool('status');
        $this->validateCurrencyProduct();
        $this->validateCategoryProduct();
        $this->validateUnitProduct();
        $this->validatePriceProduct();
        $this->validateStockProduct();
        $this->validateTitle();
        $this->validateDescription();
        $this->validateMetaTitle();
        $this->validateMetaDescription();
        $this->validateTranslation();
        $this->validateImages();
        $this->validateStoreId(false);
        $this->validateUserId(false);
        $this->validateDimensionProduct();
        $this->validateRelatedProduct();
        $this->validateClassProduct();
        $this->validateSkuProduct();
        $this->validateAttributeProduct();
        $this->validateCombinationProduct();
        $this->validateAlias();
        $this->validateUploadImages('product');

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
577825
private function validateForm(array $form): array
    {
        $resolver = new OptionsResolver();
        $resolver->setRequired([
            'url',
        ]);
        $resolver->setDefaults([
            'method' => 'POST',
            'encType' => 'application/x-www-form-urlencoded',
            'url_options' => [],
        ]);
        $resolver->setAllowedTypes('url', ['string']);
        $resolver->setAllowedTypes('url_options', ['array']);
        $resolver->setAllowedTypes('method', ['string']);
        $resolver->setAllowedTypes('encType', ['string']);
        $resolver->setAllowedValues('encType', ['application/x-www-form-urlencoded', 'text/plain', 'multipart/form-data']);
        $resolver->setAllowedValues('method', ['POST', 'GET']);

        $form = $resolver->resolve($form);

        if (! empty($form['url_options']))
        {
            foreach($form['url_options'] as $q=>$w)
            {
                $method = 'get' . ucfirst($w);
                $found = false;
                if (method_exists($this->getTemplateManager()->getEntity(), $method))
                {
                    $form['url'] = str_replace($q, $this->getTemplateManager()->getEntity()->$method(), $form['url']);
                    $found = true;
                }
                $method = 'is' . ucfirst($w);
                if (method_exists($this->getTemplateManager()->getEntity(), $method) && ! $found)
                {
                    $form['url'] = str_replace($q, $this->getTemplateManager()->getEntity()->$method(), $form['url']);
                    $found = true;
                }
                if (! $found)
                    trigger_error(sprintf('The form url does not have an option %s in the entity %s.', $w, get_class($this->getTemplateManager()->getEntity())), E_USER_ERROR);
            }
        }

        return $form;
    }
287698
public function wishlist(array &$submitted, array $options)
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateWishlist();
        $this->validateProductWishlist();
        $this->validateUserCartId();
        $this->validateStoreId();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
795476
public function trigger(array &$submitted, array $options)
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateTrigger();
        $this->validateBool('status');
        $this->validateName();
        $this->validateStoreId();
        $this->validateWeight();
        $this->validateConditionsTrigger();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
874407
public function productClass(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateProductClass();
        $this->validateBool('status');
        $this->validateTitle();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
602582
protected function checkRequiredOptions(array $options)
    {
        array_walk(
            $this->supportedOptions,
            function ($supportedOptionData, $supportedOptionName, $options) {
                if (isset($supportedOptionData[1])
                    && true === $supportedOptionData[1]
                    && empty($supportedOptionData[0])
                    && !array_key_exists($supportedOptionName, $options)
                ) {
                    throw new InvalidServiceOptionsException(
                        'Required validation option not set: ' . $supportedOptionName,
                        1456397839
                    );
                }
            },
            $options
        );
    }
1289174
public function validateAfterSchema($answerData, array $options = [])
    {
        /** @var MatchQuestion $question */
        $question = !empty($options[Validation::QUESTION]) ? $options[Validation::QUESTION] : null;
        if (empty($question)) {
            throw new \LogicException('Answer validation : Cannot perform additional validation without question.');
        }

        $errors = [];

        $proposalIds = array_map(function (Proposal $proposal) {
            return $proposal->getUuid();
        }, $question->getProposals()->toArray());

        $labelIds = array_map(function (Label $label) {
            return $label->getUuid();
        }, $question->getLabels()->toArray());

        foreach ($answerData as $answer) {
            if (!in_array($answer['itemId'], $proposalIds)) {
                $errors[] = [
                    'path' => '/itemId',
                    'message' => 'Answer `itemId` must reference an item from `items`',
                ];
            }

            if (!in_array($answer['setId'], $labelIds)) {
                $errors[] = [
                    'path' => '/setId',
                    'message' => 'Answer `setId` must reference an item from `sets`',
                ];
            }
        }

        return $errors;
    }