Skip to content

Commit

Permalink
Add check to avoid PHP warnings (#30127)
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath authored Mar 23, 2021
1 parent 021864d commit 816535d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ private static function compute_style_properties( $declarations, $styles ) {
foreach ( $properties as $prop ) {
$value = self::get_property_value( $styles, $prop['value'] );
if ( ! empty( $value ) ) {
$declarations[] = array(
$declarations[] = array(
'name' => $prop['name'],
'value' => $value,
);
Expand Down Expand Up @@ -678,6 +678,9 @@ private static function compute_preset_classes( $settings, $selector ) {
$stylesheet = '';
foreach ( self::PRESETS_METADATA as $preset ) {
$values = _wp_array_get( $settings, $preset['path'], array() );
if ( empty( $values ) ) {
continue;
}
foreach ( $values as $value ) {
foreach ( $preset['classes'] as $class ) {
$stylesheet .= self::to_ruleset(
Expand Down Expand Up @@ -716,6 +719,9 @@ private static function compute_preset_classes( $settings, $selector ) {
private static function compute_preset_vars( $declarations, $settings ) {
foreach ( self::PRESETS_METADATA as $preset ) {
$values = _wp_array_get( $settings, $preset['path'], array() );
if ( empty( $values ) ) {
continue;
}
foreach ( $values as $value ) {
$declarations[] = array(
'name' => '--wp--preset--' . $preset['css_var_infix'] . '--' . $value['slug'],
Expand Down

0 comments on commit 816535d

Please sign in to comment.