Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-customer
Model
Metadata
Form
Multiline.php
Go to the documentation of this file.
1
<?php
8
namespace
Magento\Customer\Model\Metadata\Form
;
9
10
class
Multiline
extends
Text
11
{
15
public
function
extractValue
(\
Magento
\Framework\
App
\
RequestInterface
$request
)
16
{
17
$value
= $this->
_getRequestValue
($request);
18
if
(!is_array(
$value
)) {
19
$value
=
false
;
20
}
else
{
21
$value
= array_map([$this,
'_applyInputFilter'
],
$value
);
22
}
23
return
$value
;
24
}
25
30
public
function
validateValue
(
$value
)
31
{
32
$errors
= [];
33
$attribute
= $this->
getAttribute
();
34
35
if
(
$value
===
false
) {
36
// try to load original value and validate it
37
$value
=
$this->_value
;
38
if
(!is_array(
$value
)) {
39
$value
= explode(
"\n"
,
$value
);
40
}
41
}
42
43
if
(!is_array(
$value
)) {
44
$value
= [
$value
];
45
}
46
for
(
$i
= 0;
$i
<
$attribute
->getMultilineCount();
$i
++) {
47
if
(!isset(
$value
[
$i
])) {
48
$value
[
$i
] =
null
;
49
}
50
// validate first line
51
if
(
$i
== 0) {
52
$result
= parent::validateValue(
$value
[
$i
]);
53
if
(
$result
!==
true
) {
54
$errors
=
$result
;
55
}
56
}
else
{
57
if
(!empty(
$value
[
$i
])) {
58
$result
= parent::validateValue(
$value
[
$i
]);
59
if
(
$result
!==
true
) {
60
$errors
= array_merge(
$errors
,
$result
);
61
}
62
}
63
}
64
}
65
66
if
(count(
$errors
) == 0) {
67
return
true
;
68
}
69
return
$errors
;
70
}
71
75
public
function
compactValue
(
$value
)
76
{
77
if
(!is_array(
$value
)) {
78
$value
= [
$value
];
79
}
80
return
parent::compactValue(
$value
);
81
}
82
86
public
function
restoreValue
(
$value
)
87
{
88
return
$this->
compactValue
(
$value
);
89
}
90
94
public
function
outputValue
(
$format
= \
Magento
\
Customer
\Model\Metadata\
ElementFactory::OUTPUT_FORMAT_TEXT
)
95
{
96
$values
=
$this->_value
;
97
if
(!is_array(
$values
)) {
98
$values
= explode(
"\n"
,
$values
);
99
}
100
$values
= array_map([$this,
'_applyOutputFilter'
],
$values
);
101
switch
(
$format
) {
102
case \Magento\Customer\Model\Metadata\ElementFactory::OUTPUT_FORMAT_ARRAY:
103
$output
=
$values
;
104
break
;
105
case \Magento\Customer\Model\Metadata\ElementFactory::OUTPUT_FORMAT_HTML:
106
$output
= implode(
"<br />"
,
$values
);
107
break
;
108
case \Magento\Customer\Model\Metadata\ElementFactory::OUTPUT_FORMAT_ONELINE:
109
$output
= implode(
" "
,
$values
);
110
break
;
111
default
:
112
$output
= implode(
"\n"
,
$values
);
113
break
;
114
}
115
return
$output
;
116
}
117
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\Framework\App
Magento\Customer\Model\Metadata\Form\Multiline\outputValue
outputValue($format=\Magento\Customer\Model\Metadata\ElementFactory::OUTPUT_FORMAT_TEXT)
Definition:
Multiline.php:94
Magento\Customer\Model\Metadata\Form\Multiline\compactValue
compactValue($value)
Definition:
Multiline.php:75
$attribute
$attribute
Definition:
attribute_set_with_image_attribute.php:41
Magento\Customer\Model\Metadata\Form\Multiline
Definition:
Multiline.php:10
$values
$values
Definition:
options.phtml:88
Magento\Customer\Model\Metadata\Form\AbstractData\_getRequestValue
_getRequestValue(\Magento\Framework\App\RequestInterface $request)
Definition:
AbstractData.php:458
Magento\Customer\Model\Metadata\Form\Text
Definition:
Text.php:14
$value
$value
Definition:
gender.phtml:16
$format
$format
Definition:
list.phtml:12
Magento\Customer\Model\Metadata\Form\Multiline\validateValue
validateValue($value)
Definition:
Multiline.php:30
Magento\Framework\App\RequestInterface
Definition:
RequestInterface.php:14
$output
$output
Definition:
classmap_generator.php:100
Magento\Customer\Model\Metadata\Form\Multiline\restoreValue
restoreValue($value)
Definition:
Multiline.php:86
Magento\Customer\Model\Metadata\Form\Multiline\extractValue
extractValue(\Magento\Framework\App\RequestInterface $request)
Definition:
Multiline.php:15
Magento
$request
$request
Definition:
quote_with_configurable_product_last_variation.php:22
Magento\Customer\Model\Metadata\Form
Definition:
AbstractData.php:9
Magento\Customer\Model\Metadata\ElementFactory\OUTPUT_FORMAT_TEXT
const OUTPUT_FORMAT_TEXT
Definition:
ElementFactory.php:15
Magento\Customer\Model\Metadata\Form\AbstractData\$_value
$_value
Definition:
AbstractData.php:78
Magento\Customer\Model\Customer
Definition:
Customer.php:46
$i
$i
Definition:
gallery.phtml:31
$errors
$errors
Definition:
overview.phtml:9
Magento\Customer\Model\Metadata\Form\AbstractData\getAttribute
getAttribute()
Definition:
AbstractData.php:118