Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check to avoid PHP warnings #30127

Merged
merged 1 commit into from
Mar 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious how these end up merged. Don't we have a job for this in CI? @ockham

'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