← All changes
|
build/scripts/style-engine/class-wp-style-engine-css-rule-gutenberg.php
+4
-12
23.6.2
→
22.7.0
View file →
| @@ -76,9 +76,8 @@ | ||
| 76 | 76 | */ |
| 77 | 77 | public function add_declarations( $declarations ) { |
| 78 | 78 | $is_declarations_object = ! is_array( $declarations ); |
| 79 | 79 | $declarations_array = $is_declarations_object ? $declarations->get_declarations() : $declarations; |
| 80 | - $declaration_options = $is_declarations_object ? $declarations->get_declaration_options() : array(); | |
| 81 | 80 | |
| 82 | 81 | if ( null === $this->declarations ) { |
| 83 | 82 | if ( $is_declarations_object ) { |
| 84 | 83 | $this->declarations = $declarations; |
| @@ -83,19 +82,12 @@ | ||
| 83 | 82 | if ( $is_declarations_object ) { |
| 84 | 83 | $this->declarations = $declarations; |
| 85 | 84 | return $this; |
| 86 | 85 | } |
| 87 | - $this->declarations = new WP_Style_Engine_CSS_Declarations_Gutenberg(); | |
| 86 | + $this->declarations = new WP_Style_Engine_CSS_Declarations_Gutenberg( $declarations_array ); | |
| 88 | 87 | } |
| 88 | + $this->declarations->add_declarations( $declarations_array ); | |
| 89 | 89 | |
| 90 | - foreach ( $declarations_array as $property => $value ) { | |
| 91 | - $this->declarations->add_declaration( | |
| 92 | - $property, | |
| 93 | - $value, | |
| 94 | - $declaration_options[ $property ] ?? array() | |
| 95 | - ); | |
| 96 | - } | |
| 97 | - | |
| 98 | 90 | return $this; |
| 99 | 91 | } |
| 100 | 92 | |
| 101 | 93 | /** |
| @@ -139,10 +131,10 @@ | ||
| 139 | 131 | |
| 140 | 132 | /** |
| 141 | 133 | * Gets the CSS. |
| 142 | 134 | * |
| 143 | - * @param bool $should_prettify Whether to add spacing, new lines and indents. | |
| 144 | - * @param int $indent_count The number of tab indents to apply to the rule. Applies if `prettify` is `true`. | |
| 135 | + * @param bool $should_prettify Whether to add spacing, new lines and indents. | |
| 136 | + * @param number $indent_count The number of tab indents to apply to the rule. Applies if `prettify` is `true`. | |
| 145 | 137 | * |
| 146 | 138 | * @return string |
| 147 | 139 | */ |
| 148 | 140 | public function get_css( $should_prettify = false, $indent_count = 0 ) { |