current_background_fields( $context->get_prop( 'background' ) ); $fields['background-overlay'] = null; $context->set_prop( 'background', Background_Prop_Type::generate( $fields ) ); return true; } protected function do_convert( Conversion_Context $context, array $rule ): bool { $overlays = Background_Image_Value_Parser::parse( trim( $rule['value'] ) ); if ( null === $overlays ) { return false; } $fields = $this->current_background_fields( $context->get_prop( 'background' ) ); $fields['background-overlay'] = Background_Overlay_Prop_Type::generate( $overlays ); $context->set_prop( 'background', Background_Prop_Type::generate( $fields ) ); return true; } private function current_background_fields( $existing ): array { if ( ! is_array( $existing ) ) { return []; } $type = $existing['$$type'] ?? null; if ( Background_Prop_Type::get_key() === $type && is_array( $existing['value'] ?? null ) ) { return $existing['value']; } return []; } }