- Timestamp:
- 05/03/2024 04:45:20 AM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/style-engine/class-wp-style-engine-css-rules-store.php
r55819 r58089 122 122 * 123 123 * @since 6.1.0 124 * @since 6.6.0 Added the $rules_group parameter. 124 125 * 125 126 * @param string $selector The CSS selector. 127 * @param string $rules_group A parent CSS selector in the case of nested CSS, or a CSS nested @rule, 128 * such as `@media (min-width: 80rem)` or `@layer module`. 126 129 * @return WP_Style_Engine_CSS_Rule|void Returns a WP_Style_Engine_CSS_Rule object, 127 130 * or void if the selector is empty. 128 131 */ 129 public function add_rule( $selector ) { 130 $selector = trim( $selector ); 132 public function add_rule( $selector, $rules_group = '' ) { 133 $selector = $selector ? trim( $selector ) : ''; 134 $rules_group = $rules_group ? trim( $rules_group ) : ''; 131 135 132 136 // Bail early if there is no selector. 133 137 if ( empty( $selector ) ) { 134 138 return; 139 } 140 141 if ( ! empty( $rules_group ) ) { 142 if ( empty( $this->rules[ "$rules_group $selector" ] ) ) { 143 $this->rules[ "$rules_group $selector" ] = new WP_Style_Engine_CSS_Rule( $selector, array(), $rules_group ); 144 } 145 return $this->rules[ "$rules_group $selector" ]; 135 146 } 136 147
Note: See TracChangeset
for help on using the changeset viewer.