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()
114114 $ this ->moduleDataSetup ->endSetup ();
115115 }
116116
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+
117128 /**
118129 * @param $blocks
119130 * @return bool|string
120131 */
121132 protected function getJsonForBlocks ($ blocks )
122133 {
123134 $ arrayBlocks = [];
124- $ counter = 1 ;
125135 foreach ($ blocks as $ block ) {
126- $ arrayBlocks [( string ) $ counter ] =
136+ $ arrayBlocks [$ this -> getNumberHashForBlock ( $ block ) ] =
127137 [
128138 'block_identifier ' => $ block ,
129139 'first_images_to_skip ' => ($ block == 'category.products.list ' ) ? '2 ' : '0 '
130140 ];
131-
132- $ counter ++;
133141 }
134142
135143 return $ this ->serializer ->serialize ($ arrayBlocks );
You can’t perform that action at this time.
0 commit comments