File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44namespace Loki \Flatpickr \ViewModel ;
55
6+ use Magento \Framework \App \Config \ScopeConfigInterface ;
67use Magento \Framework \View \Element \AbstractBlock ;
78use Magento \Framework \View \Element \Block \ArgumentInterface ;
9+ use Magento \Store \Model \ScopeInterface ;
810
911class Options implements ArgumentInterface
1012{
13+ public function __construct (
14+ private ScopeConfigInterface $ scopeConfig
15+ ) {
16+ }
17+
1118 public function toJson (AbstractBlock $ block ): string
1219 {
1320 $ options = array_merge ($ this ->getDefaultOptions (), (array )$ block ->getOptions ());
@@ -21,6 +28,17 @@ public function getDefaultOptions(): array
2128 'altInput ' => true ,
2229 'altFormat ' => 'Y-m-d ' ,
2330 'dateFormat ' => 'Y-m-d ' ,
31+ 'locale ' => [
32+ 'firstDayOfWeek ' => $ this ->getFirstDayOfWeek (),
33+ ]
2434 ];
2535 }
36+
37+ private function getFirstDayOfWeek (): int
38+ {
39+ return (int )$ this ->scopeConfig ->getValue (
40+ 'general/locale/firstday ' ,
41+ ScopeInterface::SCOPE_STORE
42+ );
43+ }
2644}
You can’t perform that action at this time.
0 commit comments