Skip to content

Commit

Permalink
Chore: remove declarations so API has coherence (#31596)
Browse files Browse the repository at this point in the history
  • Loading branch information
nosolosw authored May 7, 2021
1 parent 715cd65 commit b7714fe
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,12 +660,12 @@ private static function compute_preset_classes( $settings, $selector ) {
* )
* ```
*
* @param array $declarations Holds the existing declarations.
* @param array $settings Settings to process.
*
* @return array Returns the modified $declarations.
*/
private static function compute_preset_vars( $declarations, $settings ) {
private static function compute_preset_vars( $settings ) {
$declarations = array();
foreach ( self::PRESETS_METADATA as $preset ) {
$values = _wp_array_get( $settings, $preset['path'], array() );
foreach ( $values as $value ) {
Expand All @@ -691,12 +691,12 @@ private static function compute_preset_vars( $declarations, $settings ) {
* )
* ```
*
* @param array $declarations Holds the existing declarations.
* @param array $settings Settings to process.
*
* @return array Returns the modified $declarations.
*/
private static function compute_theme_vars( $declarations, $settings ) {
private static function compute_theme_vars( $settings ) {
$declarations = array();
$custom_values = _wp_array_get( $settings, array( 'custom' ), array() );
$css_vars = self::flatten_tree( $custom_values );
foreach ( $css_vars as $key => $value ) {
Expand Down Expand Up @@ -776,9 +776,7 @@ private function get_css_variables( $nodes ) {
$selector = $metadata['selector'];

$node = _wp_array_get( $this->theme_json, $metadata['path'], array() );
$declarations = array();
$declarations = self::compute_preset_vars( array(), $node );
$declarations = self::compute_theme_vars( $declarations, $node );
$declarations = array_merge( self::compute_preset_vars( $node ), self::compute_theme_vars( $node ) );

$stylesheet .= self::to_ruleset( $selector, $declarations );
}
Expand Down

0 comments on commit b7714fe

Please sign in to comment.