← All changes
|
build/scripts/style-engine/class-wp-style-engine-css-rule-gutenberg.php
+12
-4
23.0.1
→
trunk
View file →
| @@ -76,8 +76,9 @@ | ||
| 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(); | |
| 80 | 81 | |
| 81 | 82 | if ( null === $this->declarations ) { |
| 82 | 83 | if ( $is_declarations_object ) { |
| 83 | 84 | $this->declarations = $declarations; |
| @@ -82,12 +83,19 @@ | ||
| 82 | 83 | if ( $is_declarations_object ) { |
| 83 | 84 | $this->declarations = $declarations; |
| 84 | 85 | return $this; |
| 85 | 86 | } |
| 86 | - $this->declarations = new WP_Style_Engine_CSS_Declarations_Gutenberg( $declarations_array ); | |
| 87 | + $this->declarations = new WP_Style_Engine_CSS_Declarations_Gutenberg(); | |
| 87 | 88 | } |
| 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 | + | |
| 90 | 98 | return $this; |
| 91 | 99 | } |
| 92 | 100 | |
| 93 | 101 | /** |
| @@ -131,10 +139,10 @@ | ||
| 131 | 139 | |
| 132 | 140 | /** |
| 133 | 141 | * Gets the CSS. |
| 134 | 142 | * |
| 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`. | |
| 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`. | |
| 137 | 145 | * |
| 138 | 146 | * @return string |
| 139 | 147 | */ |
| 140 | 148 | public function get_css( $should_prettify = false, $indent_count = 0 ) { |