103 $this->_localeDate = $localeDate;
106 $this->_localeResolver = $localeResolver;
109 $this->_isAjax = $isAjax;
120 if (!$this->_attribute) {
121 throw new \Magento\Framework\Exception\LocalizedException(
__(
'Attribute object is undefined'));
134 $this->_requestScope = $scope;
147 $this->_requestScopeOnly = (bool)$flag;
159 $this->_extractedData =
$data;
172 if (isset($this->_extractedData[
$index])) {
173 return $this->_extractedData[
$index];
209 $filterClass =
'Magento\Framework\Data\Form\Filter\\' . ucfirst($filterCode);
210 if ($filterCode ==
'date') {
213 $filter =
new $filterClass();
276 $validateRules = $this->
getAttribute()->getValidationRules();
278 $inputValidation = ArrayObjectSearch::getArrayElementByName(
283 if ($inputValidation !==
null) {
284 switch ($inputValidation) {
286 $validator = new \Zend_Validate_Alnum(
true);
288 $validator->setMessage(
289 __(
'"%1" contains non-alphabetic or non-numeric characters.',
$label),
293 if (!$validator->isValid(
$value)) {
294 return $validator->getMessages();
298 $validator = new \Zend_Validate_Digits();
300 $validator->setMessage(
301 __(
'"%1" contains non-numeric characters.',
$label),
304 $validator->setMessage(
305 __(
'"%1" is an empty string.',
$label),
308 if (!$validator->isValid(
$value)) {
309 return $validator->getMessages();
313 $validator = new \Zend_Validate_Alpha(
true);
315 $validator->setMessage(
316 __(
'"%1" contains non-alphabetic characters.',
$label),
320 if (!$validator->isValid(
$value)) {
321 return $validator->getMessages();
340 $validator->setMessage(
341 __(
'"%1" invalid type entered.',
$label),
344 $validator->setMessage(
345 __(
'"%1" is not a valid email address.',
$label),
348 $validator->setMessage(
349 __(
'"%1" is not a valid hostname.',
$label),
352 $validator->setMessage(
353 __(
'"%1" is not a valid hostname.',
$label),
356 $validator->setMessage(
357 __(
'"%1" is not a valid hostname.',
$label),
360 $validator->setMessage(
361 __(
'"%1" is not a valid email address.',
$label),
364 $validator->setMessage(
365 __(
'"%1" is not a valid email address.',
$label),
368 $validator->setMessage(
369 __(
'"%1" is not a valid email address.',
$label),
372 $validator->setMessage(
373 __(
'"%1" uses too many characters.',
$label),
376 $validator->setMessage(
377 __(
"'%value%' looks like an IP address, which is not an acceptable format."),
380 $validator->setMessage(
381 __(
"'%value%' looks like a DNS hostname but contains a dash in an invalid position."),
384 $validator->setMessage(
386 "'%value%' looks like a DNS hostname but we cannot match it against " 387 .
"the hostname schema for TLD '%tld%'." 391 $validator->setMessage(
392 __(
"'%value%' looks like a DNS hostname but cannot extract TLD part."),
395 $validator->setMessage(
396 __(
"'%value%' does not look like a valid local network name."),
399 $validator->setMessage(
400 __(
"'%value%' looks like a local network name, which is not an acceptable format."),
403 $validator->setMessage(
405 "'%value%' appears to be a DNS hostname, but the given punycode notation cannot be decoded." 409 if (!$validator->isValid(
$value)) {
410 return array_unique($validator->getMessages());
414 $parsedUrl = parse_url(
$value);
415 if ($parsedUrl ===
false || empty($parsedUrl[
'scheme']) || empty($parsedUrl[
'host'])) {
416 return [
__(
'"%1" is not a valid URL.',
$label)];
418 $validator = new \Zend_Validate_Hostname();
419 if (!$validator->isValid($parsedUrl[
'host'])) {
420 return [
__(
'"%1" is not a valid URL.',
$label)];
427 $validator->setMessage(
428 __(
'"%1" does not fit the entered date format.',
$label),
431 if (!$validator->isValid(
$value)) {
432 return array_unique($validator->getMessages());
461 if ($this->_requestScope) {
462 if (strpos($this->_requestScope,
'/') !==
false) {
464 $parts = explode(
'/', $this->_requestScope);
465 foreach ($parts as $part) {
476 if (isset(
$params[$attrCode])) {
482 if (!$this->_requestScopeOnly &&
$value ===
false) {
const INVALID_HOSTNAME_SCHEMA
elseif(isset( $params[ 'redirect_parent']))
const CANNOT_DECODE_PUNYCODE
const IP_ADDRESS_NOT_ALLOWED
const DATE_INTERNAL_FORMAT
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
const LOCAL_NAME_NOT_ALLOWED