← All changes
|
modules/atomic-widgets/styles/atomic-styles-manager.php
+4
-16
4.3.0-beta3
→
4.2.1
View file →
| @@ -124,19 +124,17 @@ | ||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $breakpoint_path = array_merge( $path, [ $breakpoint_key ] ); |
| 127 | 127 | |
| 128 | - // `CSS_Files_Manager::get()` owns the per-breakpoint decision: it consults the | |
| 129 | - // cache-validity leaf under `$breakpoint_path` (including the `should_exist` | |
| 130 | - // meta), regenerates when the cache is invalid or when a should-be-present file | |
| 131 | - // is missing on disk, and validates the leaf on success. See ED-24903. | |
| 132 | 128 | $style_file = $this->css_files_manager->get( |
| 133 | 129 | $this->convert_path_to_handle( $breakpoint_path ), |
| 134 | 130 | $breakpoint_media, |
| 135 | 131 | $render_css, |
| 136 | - $breakpoint_path | |
| 132 | + $this->cache_validity->is_valid( $breakpoint_path ) | |
| 137 | 133 | ); |
| 138 | 134 | |
| 135 | + $this->cache_validity->validate( $breakpoint_path ); | |
| 136 | + | |
| 139 | 137 | if ( ! $style_file ) { |
| 140 | 138 | continue; |
| 141 | 139 | } |
| 142 | 140 | |
| @@ -178,24 +176,14 @@ | ||
| 178 | 176 | return Collection::make( $styles )->reduce( function( $group, $style ) { |
| 179 | 177 | Collection::make( $style['variants'] )->each( function( $variant ) use ( &$group, $style ) { |
| 180 | 178 | $breakpoint = $variant['meta']['breakpoint'] ?? self::DEFAULT_BREAKPOINT; |
| 181 | 179 | |
| 182 | - if ( empty( $breakpoint ) ) { | |
| 183 | - $breakpoint = self::DEFAULT_BREAKPOINT; | |
| 184 | - } | |
| 185 | - | |
| 186 | 180 | if ( ! isset( $group[ $breakpoint ][ $style['id'] ] ) ) { |
| 187 | - $style_for_breakpoint = [ | |
| 181 | + $group[ $breakpoint ][ $style['id'] ] = [ | |
| 188 | 182 | 'id' => $style['id'], |
| 189 | 183 | 'type' => $style['type'], |
| 190 | 184 | 'variants' => [], |
| 191 | 185 | ]; |
| 192 | - | |
| 193 | - if ( isset( $style['cssName'] ) ) { | |
| 194 | - $style_for_breakpoint['cssName'] = $style['cssName']; | |
| 195 | - } | |
| 196 | - | |
| 197 | - $group[ $breakpoint ][ $style['id'] ] = $style_for_breakpoint; | |
| 198 | 186 | } |
| 199 | 187 | |
| 200 | 188 | $group[ $breakpoint ][ $style['id'] ]['variants'][] = $variant; |
| 201 | 189 | } ); |