File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -114,22 +114,30 @@ public function apply()
114
114
$ this ->moduleDataSetup ->endSetup ();
115
115
}
116
116
117
+ /**
118
+ * @param $block
119
+ * @return string
120
+ */
121
+ protected function getNumberHashForBlock ($ block ): string {
122
+ $ numberHashFromString = sprintf ('%u ' , crc32 ($ block ));
123
+ $ numberHashFromStringSuffix = substr ($ numberHashFromString , -3 );
124
+
125
+ return '_ ' . $ numberHashFromString . $ numberHashFromStringSuffix . '_ ' . $ numberHashFromStringSuffix ;
126
+ }
127
+
117
128
/**
118
129
* @param $blocks
119
130
* @return bool|string
120
131
*/
121
132
protected function getJsonForBlocks ($ blocks )
122
133
{
123
134
$ arrayBlocks = [];
124
- $ counter = 1 ;
125
135
foreach ($ blocks as $ block ) {
126
- $ arrayBlocks [( string ) $ counter ] =
136
+ $ arrayBlocks [$ this -> getNumberHashForBlock ( $ block ) ] =
127
137
[
128
138
'block_identifier ' => $ block ,
129
139
'first_images_to_skip ' => ($ block == 'category.products.list ' ) ? '2 ' : '0 '
130
140
];
131
-
132
- $ counter ++;
133
141
}
134
142
135
143
return $ this ->serializer ->serialize ($ arrayBlocks );
You can’t perform that action at this time.
0 commit comments