← All changes
|
modules/atomic-widgets/styles/atomic-styles-manager.php
+16
-4
4.2.0
→
4.3.0-beta3
View file →
| @@ -124,17 +124,19 @@ | ||
| 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. | |
| 128 | 132 | $style_file = $this->css_files_manager->get( |
| 129 | 133 | $this->convert_path_to_handle( $breakpoint_path ), |
| 130 | 134 | $breakpoint_media, |
| 131 | 135 | $render_css, |
| 132 | - $this->cache_validity->is_valid( $breakpoint_path ) | |
| 136 | + $breakpoint_path | |
| 133 | 137 | ); |
| 134 | 138 | |
| 135 | - $this->cache_validity->validate( $breakpoint_path ); | |
| 136 | - | |
| 137 | 139 | if ( ! $style_file ) { |
| 138 | 140 | continue; |
| 139 | 141 | } |
| 140 | 142 | |
| @@ -176,14 +178,24 @@ | ||
| 176 | 178 | return Collection::make( $styles )->reduce( function( $group, $style ) { |
| 177 | 179 | Collection::make( $style['variants'] )->each( function( $variant ) use ( &$group, $style ) { |
| 178 | 180 | $breakpoint = $variant['meta']['breakpoint'] ?? self::DEFAULT_BREAKPOINT; |
| 179 | 181 | |
| 182 | + if ( empty( $breakpoint ) ) { | |
| 183 | + $breakpoint = self::DEFAULT_BREAKPOINT; | |
| 184 | + } | |
| 185 | + | |
| 180 | 186 | if ( ! isset( $group[ $breakpoint ][ $style['id'] ] ) ) { |
| 181 | - $group[ $breakpoint ][ $style['id'] ] = [ | |
| 187 | + $style_for_breakpoint = [ | |
| 182 | 188 | 'id' => $style['id'], |
| 183 | 189 | 'type' => $style['type'], |
| 184 | 190 | 'variants' => [], |
| 185 | 191 | ]; |
| 192 | + | |
| 193 | + if ( isset( $style['cssName'] ) ) { | |
| 194 | + $style_for_breakpoint['cssName'] = $style['cssName']; | |
| 195 | + } | |
| 196 | + | |
| 197 | + $group[ $breakpoint ][ $style['id'] ] = $style_for_breakpoint; | |
| 186 | 198 | } |
| 187 | 199 | |
| 188 | 200 | $group[ $breakpoint ][ $style['id'] ]['variants'][] = $variant; |
| 189 | 201 | } ); |