@@ -44,6 +44,11 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac
44
44
*/
45
45
protected $ _localeResolver ;
46
46
47
+ /**
48
+ * @var \Magento\Directory\Helper\Data
49
+ */
50
+ protected $ helperData ;
51
+
47
52
/**
48
53
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
49
54
* @param \Psr\Log\LoggerInterface $logger
@@ -68,6 +73,7 @@ public function __construct(
68
73
\Magento \Directory \Model \Resource \CountryFactory $ countryFactory ,
69
74
\Magento \Framework \Stdlib \ArrayUtils $ arrayUtils ,
70
75
\Magento \Framework \Locale \ResolverInterface $ localeResolver ,
76
+ \Magento \Framework \App \Helper \AbstractHelper $ helperData ,
71
77
$ connection = null ,
72
78
\Magento \Framework \Model \Resource \Db \AbstractDb $ resource = null
73
79
) {
@@ -77,6 +83,7 @@ public function __construct(
77
83
$ this ->_localeResolver = $ localeResolver ;
78
84
$ this ->_countryFactory = $ countryFactory ;
79
85
$ this ->_arrayUtils = $ arrayUtils ;
86
+ $ this ->helperData = $ helperData ;
80
87
}
81
88
82
89
/**
@@ -208,7 +215,11 @@ public function toOptionArray($emptyLabel = ' ')
208
215
}
209
216
$ options = [];
210
217
foreach ($ sort as $ label => $ value ) {
211
- $ options [] = ['value ' => $ value , 'label ' => $ label ];
218
+ $ option = ['value ' => $ value , 'label ' => $ label ];
219
+ if ($ this ->helperData ->isRegionRequired ($ value )) {
220
+ $ option ['is_region_required ' ] = 'true ' ;
221
+ }
222
+ $ options [] = $ option ;
212
223
}
213
224
214
225
if (count ($ options ) > 0 && $ emptyLabel !== false ) {
0 commit comments